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.
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
Posted by: Vivek Gite
The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.
SHARE THIS ON: