Question
How do I troubleshoot PHP configuration problems?
Answer
Start by locating the path of your PHP configuration files with a PHP Info file. You can learn how to set this up in the following guide:
How to use a PHPInfo file for troubleshooting PHP issues
Look for the value labeled "Loaded Configuration File".
Note the version of PHP showing as used in the PHPInfo file as well.
Then execute the following command, but replace the PHP version and ini file path to match your specific situation:
/opt/cpanel/ea-php56/root/usr/bin/php -e -c /opt/cpanel/ea-php56/root/etc/php.ini
If there are no errors in the configuration, the command will not produce any output and will hang. Use ctrl + c to exit the command.
If there is a problem with the configuration you'll see something similar to this:
/opt/cpanel/ea-php56/root/usr/bin/php -e -c /opt/cpanel/ea-php56/root/etc/php.ini
PHP: syntax error, unexpected '~' in /opt/cpanel/ea-php56/root/etc/php.ini on line 467
^C
In that situation, you'd want to check the configuration on line 467 and correct the syntax error.