This article will introduce you to several methods of interpreting PHP to restart php-fpm in one minute, which has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Start php-fpm:
/usr/local/php/sbin/php-fpm
php 5.3.3 or later php-fpm no longer supports commands such as /usr/local/php/sbin/php-fpm (start|stop|reload) that php-fpm previously had, so don’t look at this old-fashioned command anymore, you need to use signal control :
The master process can understand the following signals
INT, TERMTerminate immediately
QUITSmooth termination
USR1Reopen the log file
USR2Smoothly reload all worker processes and reload configuration and binary modules
A simple and direct restart method:
Check the master process number of php-fpm first
# ps aux | grep php-fpm | grep master | grep -v grep root 13225 0.0 0.0 204820 7508 ? Ss 09:37 0:01 php-fpm: master process (/usr/local/php/etc/php-fpm.conf) You have new mail in /var/spool/mail/root
Restart php-fpm:
kill -USR2 13225
OK.
The above scheme is generally used when the php-fpm.pid file is not generated. If you want to generate php-fpm.pid, use the following scheme:
You can see the above master process,matster
is using the/usr/local/php/etc/php-fpm.conf configuration file,cat /usr/local/php/etc/php-fpm .confFound:
[global] ; Pid file ; Note: the default prefix is /usr/local/php/var ; Default Value: none ;pid = run/php-fpm.pid
pid file path should be located at
/usr/local/php/var/run/php-fpm.pid
. Since it was commented out, it was not generated. We removed the comment and then killed -USR2 42891 to restart php-fpm. The pid file will be generated. You can use the following command to restart and close php-fpm next time:
php-fpm 关闭: kill -INT 'cat /usr/local/php/var/run/php-fpm.pid' php-fpm 重启: kill -USR2 'cat /usr/local/php/var/run/php-fpm.pid'
Recommended learning:php video tutorial
The above is the detailed content of One minute to explain several methods of restarting php-fpm in PHP. For more information, please follow other related articles on the PHP Chinese website!