One minute to explain several methods of restarting php-fpm in PHP

慕斯
Release: 2023-04-10 08:54:02
forward
11638 people have browsed it

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.

One minute to explain several methods of restarting php-fpm in PHP

Start php-fpm:

/usr/local/php/sbin/php-fpm
Copy after login

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
Copy after login

Restart php-fpm:

kill -USR2 13225
Copy after login

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,matsteris 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
Copy after login

pid file path should be located at

/usr/local/php/var/run/php-fpm.pid
Copy after login

. 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'
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!