首先确保php-fpm正常安装,运行命令php-fpm -t输出查看:
master进程可以理解以下信号
INT, TERM 立刻终止
QUIT 平滑终止
USR1 重新打开日志文件
USR2 平滑重载所有worker进程并重新载入配置和二进制模块
确定php-fpm配置是否正确
[root@localhost php]# /usr/local/php/sbin/php-fpm -t [04-Jun-2020 13:38:44] NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful
启动php-fpm
[root@localhost php]# ps -ef|grep php-fpm root 5648 2239 0 13:39 pts/1 00:00:00 grep --color=auto php-fpm [root@localhost php]# [root@localhost php]# /usr/local/php/sbin/php-fpm [root@localhost php]# [root@localhost php]# ps -ef|grep php-fpm|grep -v grep root 5650 1 0 13:39 ? 00:00:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf) daemon 5651 5650 0 13:39 ? 00:00:00 php-fpm: pool www daemon 5652 5650 0 13:39 ? 00:00:00 php-fpm: pool www
重启php-fpm
[root@localhost php]# ps -ef|grep php-fpm|grep -v grep root 5733 1 0 13:47 ? 00:00:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf) daemon 5734 5733 0 13:47 ? 00:00:00 php-fpm: pool www daemon 5735 5733 0 13:47 ? 00:00:00 php-fpm: pool www [root@localhost php]# [root@localhost php]# kill -SIGUSR2 $(cat /usr/local/php/var/run/php-fpm.pid) # 重启php-fpm [root@localhost php]# [root@localhost php]# ps -ef|grep php-fpm|grep -v grep root 5742 1 0 13:48 ? 00:00:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf) daemon 5743 5742 0 13:48 ? 00:00:00 php-fpm: pool www daemon 5744 5742 0 13:48 ? 00:00:00 php-fpm: pool www
关闭php-fpm进程
[root@localhost php]# kill -INT $(cat /usr/local/php/var/run/php-fpm.pid) [root@localhost php]# ps -ef|grep php-fpm root 5785 2239 0 13:51 pts/1 00:00:00 grep --color=auto php-fpm