How to enable PHP short tags?

后端 未结 19 2431
清酒与你
清酒与你 2020-11-21 05:29

I have a web application on a Linux server which starts with

I needed to copy this application to a windows environment and everything is working

相关标签:
19条回答
  • 2020-11-21 05:45
     short_open_tag = On
    

    in php.ini And restart your Apache Server.

    0 讨论(0)
  • 2020-11-21 05:49

    if you edit your php.ini file, remember to restart your service (apache2, etc) for the edits to php.ini to take effect

    0 讨论(0)
  • 2020-11-21 05:50

    if using xampp, you will notice the php.ini file has twice mentioned short_open_tag . Enable the second one to short_open_tag = On . The first one is commented out and you might be tempted to uncomment and edit it but it is over-ridden by a second short_open_tag

    0 讨论(0)
  • 2020-11-21 05:50

    If you are using xampp in windows then please do following

    1. Open XAMPP control panel.
    2. Click on CONFIG button.
    3. Go to PHP (php.ini) option.

    Find short_open_tag using ctrl+f utility

    You will found ;short_open_tag

    kindly remove the semicolon (;) from line.

    and keep it as short_open_tag = on

    Finally, restart your Apache server

    0 讨论(0)
  • 2020-11-21 05:51
    sed -i "s/short_open_tag = .*/short_open_tag = On/" /etc/php/7.2/apache2/php.ini
    

    That works on php7.2 on ubuntu 16, same answer as above by Bradley Flood, although the directory in which the config file is stored has changed.

    Also you can change the version in the php string to match your currently installed version.

    0 讨论(0)
  • 2020-11-21 05:52

    This can be done by enabling short_open_tag in php.ini:

    1.To locate php.ini file,on comment line execute

     php --ini
    

    you will get some thing like this,

    Configuration File (php.ini) Path: /etc
    Loaded Configuration File:         /etc/php.ini
    Scan for additional .ini files in: /etc/php.d
    Additional .ini files parsed:      /etc/php.d/curl.ini,
    /etc/php.d/fileinfo.ini,
    /etc/php.d/gd.ini,
    /etc/php.d/json.ini,
    /etc/php.d/mcrypt.ini,
    /etc/php.d/mysql.ini,
    /etc/php.d/mysqli.ini,
    /etc/php.d/pdo.ini,
    /etc/php.d/pdo_mysql.ini,
    /etc/php.d/pdo_sqlite.ini,
    /etc/php.d/phar.ini,
    /etc/php.d/sqlite3.ini,
    /etc/php.d/zip.ini
    

    See 2nd line from the comment output.The file will be in the mentioned path.

    2.Open php.ini file and find short_open_tag. By default it is in off change it to on.

    3.Restart the server,execute this comment

    service httpd restart
    

    Thanks

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