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

本文介绍了如何在不同Linux发行版上启动、停止、重启及重新加载PHP-FPM服务的方法。涵盖CentOS/RHEL 7、CentOS/RHEL 6.x、Ubuntu/Debian Linux等系统,并提供编辑配置文件的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值