Syntax error in "Custom php.ini settings" field causes php-fpm to go down; check with FPM's --test
While editing a virtual host's "Custom php.ini settings" value, I entered the following, which contains a superfluous and erroneous "&":
[code] error_reporting = E_ALL & & ~E_DEPRECATED [/code]
This is, of course, syntactically invalid. But ISPConfig went ahead and attempted to restart php-fpm anyway, which resulted in a PHP outage across every site on the server, because php-fpm was stopped but never restarted (due to the syntax error that ISPConfig saved to the configuration).
Given that php-fpm has a built-in mechanism for validating its configuration, ISPConfig should make use of this feature.
If ISPConfig is already using "php-fpm --test", then something is not working correctly, because I just tested this very example and it is caught as expected:
php-fpm --test PHP: syntax error, unexpected '&' in Unknown on line 1
[09-Sep-2015 09:56:23] ERROR: Unable to include /usr/local/zend/etc/fpm.d/web4.conf from /usr/local/zend/etc/php-fpm.conf at line 24 [09-Sep-2015 09:56:23] ERROR: failed to load configuration file '/usr/local/zend/etc/php-fpm.conf' [09-Sep-2015 09:56:23] ERROR: FPM initialization failed
Calling "php-fpm --test" returns "0" status code if the configuration is valid, and a non-zero code if it is invalid. This should make it relatively simple to test the configuration before reloading PHP-FPM, rolling-back if necessary.
This is exactly what is done with NGINX and Apache configuration changes, so the same should be applied to other services, such as PHP, wherever possible.