php-fpm Start, restart, terminate operationRecently installed the mysqli extension, restarted the Nginx, Phpinfo () did not show Mysqli, and later did not make the reason, directly using the PDO connection database. Until today, after the installation of Redis phpinfo () does not show Redis, the heart of the 10,000 Pentium Grass mud horse finally broke out, crazy find ways, just know is php-fpm did not restart, according to the method of online tinker, is Baidu article a pro, not a point, and finally tinker out, Let's say php-fpm start, restart, terminate the operation method.
Start PHP-FPM:
/usr/local/php/sbin/php-fpm
PHP 5.3.3 after the PHP-FPM no longer support PHP-FPM previously have/USR/LOCAL/PHP/SBIN/PHP-FPM (Start|stop|reload) and other commands, so do not look at this old command, need to use signal control:
The master process can understand the following signals
INT, term immediately terminates
QUIT Smooth Termination
USR1 Reopen log file
USR2 smoothly overloads all worker processes and reloads the configuration and binary modules
A simple and straightforward restart method:
Check the master process number of PHP-FPM first
# PS Aux|grep php-fpm
Root 21891 0.0 0.0 112660 960 PTS/3 r+ 16:18 0:00 grep--color=auto
php-fpm
Root 42891 0.0 0.1 182796 1220? Ss April 0:19 Php-fpm:master
Process (/usr/local/php/etc/php-fpm.conf)
Nobody 42892 0.0 0.6 183000 6516? S April 0:07 Php-fpm:pool www
Nobody 42893 0.0 0.6 183000 6508? S April 0:17 Php-fpm:pool www
Restart PHP-FPM:
KILL-USR2 42891
It's OK.
The above scenario is generally not used when generating a php-fpm.pid file, if you want to generate PHP-FPM.PID, use the following scenario:
As you can see from the master process above, Matster uses the/usr/local/php/etc/php-fpm.conf configuration file, 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
PID file path should be located in/usr/local/php/var/run/php-fpm.pid, due to comment out, so there is no generation, we remove the comment, and then KILL-USR2 42891 restart PHP-FPM, will generate a PID file, Next time you can restart with the following command, close the PHP-FPM:
PHP-FPM off:
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 '
PHP-FPM Start, restart, terminate operation