How do you restart php-fpm?
Solution 1:
Note: prepend sudo
if not root
Using SysV Init scripts directly:
/etc/init.d/php-fpm restart # typical /etc/init.d/php5-fpm restart # debian-style /etc/init.d/php7.0-fpm restart # debian-style PHP 7
Using service wrapper script
service php-fpm restart # typical service php5-fpm restart # debian-style service php7.0-fpm restart # debian-style PHP 7
Using Upstart (e.g. ubuntu):
restart php7.0-fpm # typical (ubuntu is debian-based) PHP 7 restart php5-fpm # typical (ubuntu is debian-based) restart php-fpm # uncommon
Using systemd (newer servers):
systemctl restart php-fpm.service # typical systemctl restart php5-fpm.service # uncommon systemctl restart php7.0-fpm.service # uncommon PHP 7
Or whatever the equivalent is on your system.
Solution 2:
For Mac OS X, this is what I do:
Make a script /usr/local/etc/php/fpm-restart
:
#!/bin/sh
echo "Stopping php-fpm..."
launchctl unload -w ~/Library/LaunchAgents/homebrew-php*.plist
echo "Starting php-fpm..."
launchctl load -w ~/Library/LaunchAgents/homebrew-php*.plist
echo "php-fpm restarted"
exit 0
Then:
chmod ug+x /usr/local/etc/php/fpm-restart
cd /usr/local/sbin
ln -s /usr/local/etc/php/fpm-restart
make sure /usr/local/sbin is in your $PATH
then just call it from the terminal fpm-restart and BOOM!!
Solution 3:
Usually, service php5-fpm restart
will do fine, on an up-to-date distribution.
But somtimes, it fails, telling you restart: Unknown instance:
(or such).
Now, if you do not like to reboot your server, just kill the processes and have a fresh start (edited as of here):
$ sudo pkill php5-fpm; sudo service php5-fpm start
Solution 4:
This should work:
pkill -o -USR2 php-fpm
pkill -o -USR2 php5-fpm
Solution 5:
For Mac OSX brew services restart php56
worked for me.