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 :
/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
php5-fpm.conf, run a
cat to see the content and find the lines :
# 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 :
reload signal USR2
service php5-fpm restart, you’ll get warning though. Because, of this script :
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 :
curl or wget this file :
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 :
copy-paste this :
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 :
echo "PHP5-FPM Restarted!"
Now chmod it rightly & symlink it :
chmod ug+x /usr/local/etc/php/fpm-restart && cd /usr/local/sbin
ln -s /usr/local/etc/php/fpm-restart