How to enable the "short_open_tag" directive through. Htaccess Apache [PHP 5.3]

I am currently using PHP 5.3.8, and I cannot access it with php.ini .

I absolutely need to enable the PHP "short_open_tag" directive on "He" because I work with a great CMS that only uses <? ?> <? ?> .

I tried to enable it using Apache.htaccess ( php_value short_open_tag 1 ), but adding this causes Apache to always throw 500 errors.

NB My server works with PHP in CGI mode.

+4
source share
2 answers

If PHP works like CGI, then you cannot use the .htaccess file to set PHP flags, this only works if PHP is an Apache module.

You can use ini_set to set this flag from a PHP script, but this will not help you, since ini_set only affects the current PHP process and is not saved.

Your only option is to ask your host to include short tags in php.ini or edit each PHP file to replace <? with <?php <? with <?php

+1
source

You should be able to use ...

 ini_set('short_open_tag', '1'); 

According to the documentation ( PHP_INI_ALL ).

Hope this big CMS has a front controller where you can replace the first <? on <?php and then use ini_set() .

0
source

All Articles