restart php5-fpm from php script
Ok, this is a tricky one (I think) I need to reload php5-fpm from a php script The obvious issue is that once the reload command is executed, the current script is disturbed, I tried to delay the execution like so
(sleep 5; sudo service php5-php reload) & echo ""
but this does not help,
the immediate nginx response is 502 bad gateway.
FYI, i'm using php's exec
function
any way around this?
Make sure the user running php has the sudo privileges to reload php5-fpm, then:
shell_exec("nohup sh -c 'sleep 1; sudo reload php5-fpm' > /dev/null 2>&1 &");