Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to reload my php.ini and there's nothing in the help dialog about restarting it.

share|improve this question

9 Answers 9

up vote 114 down vote accepted

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
  • Using service wrapper script

    service php-fpm restart    # typical
    service php5-fpm restart   # debian-style
  • Using Upstart (e.g. ubuntu):

    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

Or whatever the equivalent is on your system.

share|improve this answer
none of those worked – Galen Oct 12 '10 at 14:30
For Googlers (such as myself) arriving here: this answer was correct, but on my system it was named 'php5-fpm', so service php5-fpm restart did the trick. – Matt Winckler Feb 1 '11 at 17:03
What about on a Mac? php-fpm was installed using homebrew. which php-fpm gives /usr/local/sbin/php-fpm. – hobbes3 Mar 16 '13 at 23:06

This should work:

pkill -o -USR2 php-fpm
pkill -o -USR2 php5-fpm
share|improve this answer
If you installed PHP-FPM via homebrew on a Mac, the first command works a lot better than unload+load'ing the plist – alanthing Jul 19 '13 at 21:01
OSX: killall php-fpm – memeLab Aug 22 '14 at 14:28
On OSX the above gave me an error "Unknown user SR2". Reversing the arguments fixed it: "pkill -USR2 -o php-fpm" – Keeth Jan 9 at 11:44
Exactly what I needed to restart FPM in a container, thanks! – Adrian Günter Oct 27 at 0:32

To allow the PHP-FPM restart script to work, you must use specify a PID file in your php-fpm.conf file. i.e.

pid = /var/run/php-fpm/

The default value for pid in php-fpm.conf is nothing, which means to not create a PID file, which means that the restart script can't tell which process to end during the restart.

share|improve this answer

For Mac OS X, this is what I do:

Make a script /usr/local/etc/php/fpm-restart:


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


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!!

share|improve this answer
Use homebrew.mxcl.php*.plist if it doesn't work – Daniil Ryzhkov Aug 11 at 20:21

For me I had just upgraded via apt and the service restart wasn't working. I ended up needing to kill the existing processes before it worked using: killall php5-fpm

share|improve this answer

php-fpm will restart if you send a USR2 signal to the main process:

sudo kill -USR2 php-fpm_main_process_id

So we just need to instruct php-fpm to record its pid somewhere. In this example, I'll assume you want to save it at /etc/private/, and that php-fpm runs as user _php. First, add this line to the configuration file:

pid = /etc/

Then create the file /etc/, and make sure php-fpm has permission to modify it:

$ cd /etc
$ sudo touch
$ sudo chown _php
$ sudo chmod 644

Now, next time php-fpm starts, you'll be able to get its pid and restart it like this:

$ cat /etc/
$ sudo kill -USR2 815

Or you can combine these into a single command:

$ sudo kill -USR2 `cat /etc/private/`
share|improve this answer

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
share|improve this answer

For old versions of debian & ubuntu - php 5.6 it will be

 /etc/init.d/php-fpm56 restart
 service php-fpm56 restart
share|improve this answer

On Windows:

  1. Open Services in the Management Console:

    Start -> Run -> "services.msc" -> OK
  2. Select php-fpm from the list

  3. Rightclick and select restart
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.