@@ -212,11 +212,12 @@ function restartHttpd($action = 'restart') {
212212
213213 $ retval = array ('output ' => '' , 'retval ' => 0 );
214214 if ($ action == 'restart ' ) {
215- exec ($ app ->system ->getinitcommand ($ daemon , 'restart ' ).' 2>&1 ' , $ retval ['output ' ], $ retval ['retval ' ]);
216-
215+ $ cmd = $ app ->system ->getinitcommand ($ daemon , 'restart ' );
217216 } else {
218- exec ( $ app ->system ->getinitcommand ($ daemon , 'reload ' ). ' 2>&1 ' , $ retval [ ' output ' ], $ retval [ ' retval ' ] );
217+ $ cmd = $ app ->system ->getinitcommand ($ daemon , 'reload ' );
219218 }
219+ exec ($ cmd .' 2>&1 ' , $ retval ['output ' ], $ retval ['retval ' ]);
220+ $ app ->log ("Restarting httpd: $ cmd " , LOGLEVEL_DEBUG );
220221
221222 // nginx: do a syntax check because on some distributions, the init script always returns 0 - even if the syntax is not ok (how stupid is that?)
222223 if ($ web_config ['server_type ' ] == 'nginx ' && $ retval ['retval ' ] == 0 ){
@@ -249,13 +250,30 @@ function restartPHP_FPM($action = 'restart') {
249250 if (preg_match ('/^ID=ubuntu/m ' , $ tmp ) && preg_match ('/^VERSION_ID="14\.04"/m ' , $ tmp )) {
250251 $ initcommand = '/sbin/start-stop-daemon --stop --signal USR2 --quiet --pidfile /var/run/php5-fpm.pid --name php5-fpm ' ;
251252 }
253+ // And the next workaround, php-fpm reloads in centos 7 downt work as well.
254+ if (preg_match ('/^ID=centos/m ' , $ tmp ) && preg_match ('/^VERSION_ID="7"/m ' , $ tmp )) {
255+ $ initcommand = 'systemctl restart php-fpm.service ' ;
256+ }
257+ unset($ tmp );
258+ }
259+ }
260+
261+ if ($ action == 'reload ' ) {
262+ // And the next workaround, php-fpm reloads in centos 7 downt work as well.
263+ if (file_exists ('/etc/os-release ' )) {
264+ $ tmp = file_get_contents ('/etc/os-release ' );
265+ // And the next workaround, php-fpm reloads in centos 7 downt work as well.
266+ if (preg_match ('/^ID="centos"/m ' , $ tmp ) && preg_match ('/^VERSION_ID="7"/m ' , $ tmp )) {
267+ $ initcommand = 'systemctl restart php-fpm.service ' ;
268+ }
252269 unset($ tmp );
253270 }
254271 }
255272 }
256273
257274 $ retval = array ('output ' => '' , 'retval ' => 0 );
258275 exec ($ initcommand .' 2>&1 ' , $ retval ['output ' ], $ retval ['retval ' ]);
276+ $ app ->log ("Restarting php-fpm: $ initcommand " , LOGLEVEL_DEBUG );
259277 return $ retval ;
260278 }
261279
0 commit comments