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
If you are using Ubuntu
with Apache+php5
, then on current versions there are 2 places where you need to change to short_open_tag = On
/etc/php5/apache2/php.ini
- this is for the pages loaded through your web server (Apache)/etc/php5/cli/php.ini
- this configuration is used when you launch your php files from command line, like: php yourscript.php
- that goes for manually or cronjob executed php files directly on the server.Set the asp_tags = On
and short_open_tag = On
in both the files \apache\Apache2.2.21\bin\php.ini
and \bin\php\php5.3.8\php.ini
and then restart the apache server.
In CentOS 6(tested on Centos 7 too) you can't set short_open_tag in /etc/php.ini for php-fpm. You will have error:
ERROR: [/etc/php.ini:159] unknown entry 'short_open_tag'
ERROR: Unable to include /etc/php.ini from /etc/php-fpm.conf at line 159
ERROR: failed to load configuration file '/etc/php-fpm.conf'
ERROR: FPM initialization failed
You must edit config for your site, which can found in /etc/php-fpm.d/www.conf And write at end of file:
php_value[short_open_tag] = On
To set short tags to open from a Vagrant install script on Ubuntu:
sed -i "s/short_open_tag = .*/short_open_tag = On/" /etc/php5/apache2/php.ini
I can see all answers above are partially correct only. In reality all 21st Century PHP apps will have FastCGI Process Manager(php-fpm) so once you have added php-info() into your test.php script and checked the correct path for php.ini
Go to php.ini and set short_open_tag = On
IMPORTANT: then you must restart your php-fpm process so this can work!
sudo service php-fpm restart
and then finally restart your nginx/http server
sudo service nginx restart
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
;short_open_tag=Off <--Comment this out
; XAMPP for Linux is currently old fashioned
short_open_tag = On <--Uncomment this