Centos 7: "Path to the PHP-FPM init script" field ignored. Additional PHP versions don't work.
For Centos 7/systemd, as far as I can tell, web_module.inc.php will always restart php-fpm.service regardless of what $init_script is set to. This results in a broken website (503 errors) and possibly a crashed php-fpm service due to port conflicts between alternate versions.
Restarting the php-fpm services in the right order manually restores operation.
As a workaround I have modified the web_module.inc.php script to look for a value of $init_script with no slashes and .service at the end to indicate a systemd service rather than a script. This works for me but probably isn't a good final solution since I assume the action is always "restart" and the field description, "Path to the PHP-FPM init script" in the UI should really be something like "PHP-FPM systemd service name".
--- web_module.inc.php_orig 2016-09-09 16:24:19.555706424 +0100
+++ web_module.inc.php 2016-09-09 16:25:11.547316234 +0100
@@ -239,6 +239,9 @@
//$init_script = $conf['init_scripts'].'/'.$web_config['php_fpm_init_script'];
$initcommand = $app->system->getinitcommand($web_config['php_fpm_init_script'], $action);
} else {
+ if (preg_match('/^[^\/]*\.service$/', $init_script) == 1) {
+ $initcommand = 'systemctl restart ' . $init_script;
+ } else {
$path_parts = pathinfo($init_script);
$initcommand = $app->system->getinitcommand($path_parts['basename'], $action, $path_parts['dirname']);
@@ -270,6 +273,7 @@
}
}
}
+ }
$retval = array('output' => '', 'retval' => 0);