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

Summarize a series of startup operations of php-fpm

藏色散人
藏色散人forward
2021-12-28 16:28:434526browse

Various ways to start php-fpm:

The simplest operation to start php-fpm:

/usr/local/php/sbin/php-fpm

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

Restart php-fpm:

kill -USR2 27556

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

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'

php-fpm restart:

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

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!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete