Parse error: syntax error, unexpected T_STRING

Sometimes your website is loading with the following error:

~~~~~
Parse error: syntax error, unexpected T_STRING
~~~~~

If you are getting the above error on your website, you need to turn off the PHP module 'short_open_tag' in your 'php.ini' file.

short_open_tag = Off

Note: 'short_open_tag' tells PHP whether the short form (<? ?>) of PHP's open tag should be allowed. If you want to use PHP in combination with XML, you can disable this option in order to use <?xml ?> inline. Otherwise, you can print it with PHP, for example: <?php echo '<?xml version="1.0"?>'; ?>. Also, if disabled, you must use the long form of the PHP open tag (<?php ?>).

You can do it either in your custom 'php.ini' file present under "public_html" directory or in global 'php.ini' file. You can get the global 'php.ini' file location using the following command:

# php -i | grep php.ini

P.S:-  You need to add the parameter "suPHP_ConfigPath" in your '.htaccess' file such that the custom 'php.ini' settings are applied to all the directories under public_html.

# suPHP_ConfigPath /home/username*/public_html

*Replace username with the correct username of your domain.

Thank you.

Comments

Popular posts from this blog

SVN: File remains in conflict

12 tweakings for WHM/cPanel to speed up WordPress

HowTo: Enable extended logging for exim