PHP5-FPM Restart Can Be Fixed on Ubuntu in 2 Ways. Our Famous Nginx PHP5-FPM Restart Fix Needs a Note For Ubuntu Instances on HP Cloud. We have forgotten how we fixed the issue, but our uploading the fix to Github seems to be useful for the users. We are elaborating the issue along with our fix and alternative method.
Nginx PHP5-FPM Restart Fix Note For Ubuntu : Problem Scenario
The user installed PHP5-FPM. Then changed some basic settings around php.ini
or installed some dependent packages. Upon running service php5-fpm restart
, the server will not take restart and throw “stop: Unknown instance” error.
Upon reboot, PHP5-FPM may fail to start again. It is pathetic & not intentionally created. Running tail -f /var/log/php5-fpm.log&
returns no significant issue.
Nginx PHP5-FPM Restart Fix Note For Ubuntu : Our Way of Fix
Here is our full Github project to fix the Ngnx PHP5-FPM Restart Issue. As you can see, it is licensed under GNU GENERAL PUBLIC LICENSE, that means it is a Free Software.
---
Problem creating file is :
1 | /etc/init/php-fpm.conf |
cd to /etc/init/
and do a ls to check the file name. The filename can be different (php-fpm or php5-fpm). cd to /etc/init/ and
find the file named php-fpm.conf
or php5-fpm.conf
, run a cat
to see the content and find the lines :
1 2 3 4 5 | # Precise upstart does not support reload signal, and thus rejects the # job. We'd rather start the daemon, instead of forcing users to # reboot https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1272788 # # reload signal USR2 |
and uncomment this :
1 | reload signal USR2 |
on running service php5-fpm restart
, you’ll get warning though. Because, of this script :
1 | /etc/init.d/php5-fpm |
Open Filezilla, take backup of /etc/init.d/php5-fpm on your computer, delete php5-fpm script from /etc/init.d/
and create a new script :
1 | nano /etc/init.d/php5-fpm |
curl or wget this file :
1 | https://raw.githubusercontent.com/AbhishekGhosh/Nginx-PHP5-FPM-Restart-Fix-on-Ubuntu/master/php5-fpm |
reboot, PP5-FPM will work fine :)
Nginx PHP5-FPM Restart Fix Note For Ubuntu : Alternative Way of Fix
On the Ubuntu launchpad forums it is suggested that users may create an /etc/init/php5-fpm.override
file with only reload signal USR2
in it instead of editing /etc/init/php5-fpm.conf
file. There is no other difference on the rest of the method.
Nginx PHP5-FPM Restart Fix Note For Ubuntu : For OS X
/usr/local/sbin
is your $PATH
. Create a new file :
1 | nano /usr/local/etc/php/fpm-restart |
copy-paste this :
1 2 3 4 5 6 7 8 9 10 11 12 13 | #!/bin/sh echo "Custom Script Stopping PHP5-FPM..." launchctl unload -w ~/Library/LaunchAgents/homebrew-php*.plist echo "Custom Script Starting PHP5-FPM..." launchctl load -w ~/Library/LaunchAgents/homebrew-php*.plist # alternate file name, use if current does not work : # homebrew.mxcl.php*.plist echo "PHP5-FPM Restarted!" exit 0 |
Now chmod it rightly & symlink it :
1 2 | chmod ug+x /usr/local/etc/php/fpm-restart && cd /usr/local/sbin ln -s /usr/local/etc/php/fpm-restart |
Thats it.
Tagged With php5-fpm restart