How to reload/restart php7.0-fpm / php5.0-fpm service

I am a new Linux and Unix system user. I want to reload or restart my PHP-fpm service. How do I restart PHP-fpm? How do you restart php7.0-fpm on Ubuntu Linux 16.04 LTS server?

PHP-FPM is nothing but a straightforward and robust FastCGI Process Manager for PHP. You can use it with Apache, Nginx, and other web servers. It includes many advanced features. Let us see how to stop or restart or reload PHP-FPM after you update php.ini file.

ADVERTISEMENTS

How do you restart php-fpm?

How do I edit php.ini or www.conf file?

To edit php.ini type:
$ sudo vi /etc/php5/php.ini
OR
$ sudo vi /etc/php/7.0/fpm/php.ini
To edit php-fpm config file:
$ sudo vi /etc/php/7.0/fpm/php-fpm.conf
$ sudo vi /etc/php/7.0/fpm/pool.d/www.conf

Once edited, save and close the file. Now you need to run command as per your Linux/Unix distro version after editing the file.

Start php-fpm on CentOS/RHEL 7

$ sudo systemctl start php-fpm

Stop php-fpm CentOS/RHEL 7

$ sudo systemctl stop php-fpm

Reload php-fpm CentOS/RHEL 7

$ sudo systemctl reload php-fpm

Restart php-fpm CentOS/RHEL 7

$ sudo systemctl restart php-fpm

Start/stop/restart/reload php-fpm on CentOS/RHEL 6.x or older

Type the following command:
$ sudo service php-fpm start # <- start it
$ sudo service php-fpm stop # <- stop it
$ sudo service php-fpm restart # <- restart it
$ sudo service php-fpm reload # <- reload it

How to start/stop/restart/reload php5-fpm (php version 5.x) on Ubuntu/Debian Linux

$ sudo service php5-fpm start
$ sudo service php5-fpm stop
$ sudo service php5-fpm restart # <- restart it
$ sudo service php5-fpm reload # <- reload it

OR if you are using systemd based distro such as Ubuntu Linux 16.04+ LTS or Debian Linux 8.x+:
$ sudo systemctl start php7.0-fpm.service
$ sudo systemctl stop php5-fpm.service
$ sudo systemctl restart php5-fpm.service # <- restart it
$ sudo systemctl reload php5-fpm.service # <- reload it

How to start/stop/restart/reload php7.0-fpm (php version 7.x) on Ubuntu/Debian Linux

$ sudo service php7.0-fpmstart
$ sudo service php7.0-fpm stop
$ sudo service php7.0-fpm restart # <- restart it
$ sudo service php7.0-fpm reload # <- reload it

OR if you are using systemd based distro such as Ubuntu Linux 16.04+ LTS or Debian Linux 8.x+:
$ sudo systemctl start php7.0-fpm.service
$ sudo systemctl stop php7.0-fpm.service
$ sudo systemctl restart php7.0-fpm.service # <- restart it
$ sudo systemctl reload php7.0-fpm.service # <- reload it

How do you restart/reload php-fpm on Alpine Linux?

The syntax is:
# /etc/init.d/php-fpm start
# /etc/init.d/php-fpm stop
# /etc/init.d/php-fpm restart # <- restart it

How do you restart/reload php-fpm on FreeBSD unix?

The syntax is
# /usr/local/etc/rc.d/php-fpm start
# /usr/local/etc/rc.d/php-fpm stop
# /usr/local/etc/rc.d/php-fpm reload # <- reload it
# /usr/local/etc/rc.d/php-fpm restart # <- restart it

OR use the service command:
# service php-fpm start
# service php-fpm stop
# service php-fpm restart
# service php-fpm reload

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
3 comments… add one
  • Wilson Hauck Sep 15, 2020 @ 13:07

    After php-fpm restart, should there be any consideration for KILL of old php-fmp processes that would remain on HTOP or TOP list of processes?
    Thank you.

    • 🐧 Vivek Gite Sep 15, 2020 @ 13:58

      When you do restart, all older php-fpm process will be killed and new will be started.

  • Marlon (esolitos) Sep 23, 2020 @ 9:55

    I can suggest also instead of completely killing the php-fpm process to simply use the `USR2` signal. :)
    Example:
    kill -USR2 123
    where “123” is the php-fpm process id (pid).
    If you don’t know the php-fpm pid you can also get it in a few different ways, one of which is by running pgrep "php-fpm" | sort | head -1

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.