php: “short_open_tag = On” not working

后端 未结 4 610
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 04:48

I have recently installed Win8 on my computer. Then I instaled wamp 2.2 with php 5.4 and I am unable to make short tag work.

I have already put:

相关标签:
4条回答
  • 2020-12-06 05:23

    Change the value of short_open_tag to On.

    And if your php.ini file is located in /etc/php/5.6/fpm you need to restart the php5.6-fpm service with

    sudo service php5.6-fpm restart
    
    0 讨论(0)
  • 2020-12-06 05:24

    I had the same problem recently after upgrading from PHP 5.3.18 to PHP 5.5.9..

    I realized that for some reason, short_open_tag was appearing in my php.ini file twice.

    If you did a find to get to that part of your php.ini file, try continuing the find to see if there is another instance.

    0 讨论(0)
  • 2020-12-06 05:27

    Make sure to replace all

    short_open_tag
    

    occurrences within the php.ini file. In my case there were multiple places where it was defined. For me, the wrong setting was located under

    ;;;;;;;;;;;;;;;;;;;;
    ; Language Options ;
    ;;;;;;;;;;;;;;;;;;;;
    
    0 讨论(0)
  • 2020-12-06 05:45

    Set the :

    asp_tags = On and short_open_tag = On 
    

    in both the files \apache\Apache2.2.22\bin\php.ini and \bin\php\php5.4\php.ini and then restart the apache server.

    If you don't have access to the php.ini you can try to enable them trough the .htaccess file but it's possible the hosting company disabled this if you are on shared hosting:

    php_value short_open_tag 1
    

    Remember to restart your service (apache2, etc) for the edits to php.ini to take effect.

    0 讨论(0)
提交回复
热议问题