I am having some problems with ubuntu and php5-fpm on my VPS. Php works fine, however it throws terminal error when I am trying to reload / restart / stop it. Basically, I c
Seems like the service
command sometimes fails. I don't know about the reason, however I ended up using this workaround in /etc/logrotate.d/php5-fpm
:
/var/log/php5-fpm.log {
...
postrotate
# The original reload command did never work
#invoke-rc.d php5-fpm reopen-logs > /dev/null
# Workaround for cases when the reload command fails for some reason
service php5-fpm reload > /dev/null 2>&1
[ $? = 0 ] || ( service php5-fpm stop; pkill php5-fpm; service php5-fpm start ) > /dev/null
endscript
}
The option that worked for me was to reset opcache. Create a file opcache-reset.php file in your site root and add:
<?php opcache_reset(); ?>
After reseting opcache, you can delete the file or move it out of your site root.
Deploying with Envoyer brought me here. I ended up adding a 'before' deployment hook to the Activate New Release action with the pkill php5-fpm
process
Usually, the service
command will do fine:
service php5-fpm restart
But if the "unknown instance" issue appears, you can just kill the processes and have the service restarted, using this line:
sudo pkill php5-fpm; sudo service php5-fpm start
Try to stop your php5-fpm instance by service php5-fpm stop
again. Wait for some seconds. Try to see, which processes was not terminated using ps -ef
. Terminate them by kill <processId>
. Start php5-fpm again.
Is seems, not all child processes was terminated properly by service ...
command.
I have similar issues in on server, but they are not regular
I have experienced the same issue using Envoyer for Laravel - and that was quite annoying. My solution was to follow option 3) at https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1242376/comments/16
Create /etc/init/php5-fpm.override file with the single line "reload signal USR2" in it.