Search code examples
php.htaccessphp-shorttags

Enable PHP short open tags via .htaccess


I’m currently running through a tutorial for a CMS system which unfortunately uses short open tags.

I’ve confirmed that my host will not allow these in their PHP config, but that they run PHP in Apache mode (as opposed to CGI). To the best of my knowledge, this should then allow me to set the short_open_tag flag to on in an .htaccess file.

However, this appears to not be working. In the root directory, I've created an .htaccess file with just the following line, but the short open tags are still being ignored.

php_flag short_open_tag on

Am I doing something wrong? If not, can anyone suggest why it may not be working? Thanks.

Note: Someone has marked this question as being answered somewhere else. Not only does the question identified not have an accepted answer, it's based around and PHP config running in CGI mode, not Apache mode.


Solution

  • Try this

     <IfModule mod_php5.c>
       php_value short_open_tag 1
     </IfModule>
    

    This would solve the problem