php 5.3.3 以后的php-fpm 不再支持 php-fpm(start|stop|reload)等命令,所以不在介绍旧的方法,需要使用新的信号控制:
INT, TERM 立刻终止
QUIT 平滑终止
USR1 重新打开日志文件
USR2 平滑重载所有worker进程并重新载入配置和二进制模块
现在看下如何重启:
1.先查看php-fpm的master进程号
[root@iZ2ze1o1f17iu7osdy7bukZ ~]# ps aux | grep php-fpm |grep master
root 84659 0.0 0.2 129476 8216 ? Ss Feb19 0:12 php-fpm: master process (/www/server/php/56/etc/php-fpm.conf)
root 84676 0.0 0.2 129476 8208 ? Ss Feb19 0:12 php-fpm: master process (/www/server/php/56/etc/php-fpm.conf)
root 125290 0.0 0.2 126836 9528 ? Ss Feb20 0:11 php-fpm: master process (/www/server/php/73/etc/php-fpm.conf)
root 526126 0.0 0.3 275668 12116 ? Ss 21:27 0:00 php-fpm: master process (/www/server/php/73/etc/php-fpm.conf)
2.从上面找到php7.3的配置文件查看里面pid路径
[root@iZ2ze1o1f17iu7osdy7bukZ ~]# cat /www/server/php/73/etc/php-fpm.conf
[global]pid = /www/server/php/73/var/run/php-fpm.pid
error_log = /www/server/php/73/var/log/php-fpm.log
log_level = notice
[www]
listen = /tmp/php-cgi-73.sock
listen.backlog = 8192
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.status_path = /phpfpm_73_status
pm.max_children = 80
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 20
request_terminate_timeout = 100
request_slowlog_timeout = 30
slowlog = var/log/slow.log
3.查看php7.3的php-fpm的pid
[root@iZ2ze1o1f17iu7osdy7bukZ ~]# cat /www/server/php/73/var/run/php-fpm.pid
526899
4.重启7.3的php-fpm
kill -USR2 526899
5.整合到一起重启php7.3的php-fpm,注意下面不是单引号,是反引号
重启
kill -USR2 `cat /www/server/php/73/var/run/php-fpm.pid`
停止
kill -INT `cat /www/server/php/73/var/run/php-fpm.pid`