Improvements for php-fpm reload code
Thank you to Dominik for providing this code.
In der web_module.inc.php gaaaaanz unten vor dem return $retval folgenden Block rein:
// Now test if restart has hung up and do a restart instead of reload
if (($init_script) && ($action == 'reload') && ($init_script != conf['init_scripts'].'/'.
web_config['php_fpm_init_script'])) {
path_parts = pathinfo(
init_script);
$childcnt = exec('echo (pgrep -c -P
(</opt/'.str_replace('-fpm', '', $path_parts['basename']).'/var/run/php-fpm.pid))');
// Count child-process number must be greater than 2
// 2 is the default process child-count (pm.start_servers = 2) -> see php-fpm.conf
// if it is only 2, then restart is also ok, because no webpages on it
if ($childcnt <= 2) {
$initcommand = $app->system->getinitcommand($path_parts['basename'], 'restart', $path_parts['dirname']);
$retval = array('output' => '', 'retval' => 0);
exec($initcommand.' 2>&1', $retval['output'], $retval['retval']);
$app->log("Restarting php-fpm after reload not worked: $initcommand", LOGLEVEL_DEBUG);
}
unset($childcnt);
}
Außerdem - beim den bisherigen Ausnahmen schlage ich vor die Zeile 261 (master-Stand) if($action == 'reload') { mit einem "else" anfangen zu lassen -> sonst läuft es bei ner reload-Action die schon in der ersten If-Abfrage drin war durch den zweiten Block auch noch durch... und das Init-Command im zweiten If sollte so aussehen: $initcommand = $app->system->getinitcommand($path_parts['basename'], 'restart', $path_parts['dirname']); weil das was aktuell drin steht startet einfach nur nochmal den System-FPM-Dienst statt dem Versionsspezifischen wofür es eigentlich da sein sollte....