Home > Backend Development > PHP Tutorial > Summarize a series of startup operations of php-fpm

Summarize a series of startup operations of php-fpm

藏色散人
Release: 2023-04-10 20:50:01
forward
4668 people have browsed it

Various ways to start php-fpm:

The simplest operation to start php-fpm:

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

php 5.3.3 The future php-fpm will no longer support the /usr/local/php/sbin/php-fpm (start|stop|reload) and other commands that php-fpm had before, so don’t read this anymore This is an old-fashioned command. You need to use signal control:

The master process can understand the following signals:

  • INT, TERM Terminate immediately
  • QUIT Smooth termination
  • USR1 Reopen the log file
  • USR2 Gracefully reload all worker processes and reload configuration and binary modules

A simple and direct restart method:

First check the master process number of php-fpm

[root@test ~]# ps -ef|grep php-fpm
root     27556     1  0 15:57 ?        00:00:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
www      27557 27556  0 15:57 ?        00:00:00 php-fpm: pool www             
www      27558 27556  0 15:57 ?        00:00:00 php-fpm: pool www             
www      27559 27556  0 15:57 ?        00:00:00 php-fpm: pool www             
www      27560 27556  0 15:57 ?        00:00:00 php-fpm: pool www     
root     27733 26938  0 16:35 pts/0    00:00:00 grep php-fpm
Copy after login

Restart php-fpm:

kill -USR2 27556
Copy after login

This is OK. [Recommended: PHP Video Tutorial]

The above solution is generally used when the php-fpm.pid file is not generated. If you want to generate php-fpm.pid, use the following solution:

As you can see from the master process above, matster uses the configuration file /usr/local/php/etc/php-fpm.conf. Cat /usr/local/php/etc/php-fpm.conf found :

[global]
; Pid file; Note: the default prefix is /usr/local/php/var
; Default Value: none
;pid = run/php-fpm.pid
Copy after login

The pid file path should be located at /usr/local/php/var/run/php-fpm.pid. Since it is commented out, it is not generated. We remove the comment and then kill -USR2 42891 to restart php. -fpm, the pid file will be generated. Next time, you can use the following command to restart and close php-fpm:

php-fpm close:

kill -INT 'cat /usr/local/php/var/run/php-fpm.pid'
Copy after login

php-fpm restart:

kill -USR2 'cat /usr/local/php/var/run/php-fpm.pid'
Copy after login

The above is the detailed content of Summarize a series of startup operations of php-fpm. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template