Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

apache

cgi

I am currently using PHP 5.3.8 and I can not access it with php.ini.

I absolutely must enable the PHP directive "short_open_tag" to On it because I work with a great CMS that uses only the <? ?>.

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

N.B. My server works with PHP in CGI mode.

like image 242
Yasmina Saraya Avatar asked Nov 13 '22 17:11

Yasmina Saraya


1 Answers

If PHP is running as a CGI, then you cannot use a .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 won't help you since ini_set only affects the currently running PHP process and doesn't persist.

Your only option may be to request your host enable short tags in php.ini, or edit each PHP file to replace <? with <?php

like image 160
drew010 Avatar answered Dec 05 '22 07:12

drew010