the fpm process supports the USER2 signal, which is used to reload the config file.
kill -USR2 [pid]
should do the trick.
FastCGI 进程管理器 (FPM)
Table of Contents
FPM (FastCGI 进程管理器) 用于替换PHP FastCGI的大部分附加功能,对于高负载网站是非常有用的。
它的功能包括:
-
支持平滑停止/启动的高级进程管理功能;
-
可以工作于不同的uid/gid/chroot环境下,并监听不同的端口和使用不同的php.ini配置文件(可取代safe_mode的设置);
-
stdout 和 stderr 日志记录;
-
在发生意外情况的时候能够重新启动并缓存被破坏的opcode;
-
文件上传优化支持;
-
"慢日志" - 记录脚本 (不仅记录文件名,还记录PHP backtrace信息,可以使用ptrace或者类似工具读取和分析远程进程的运行数据) 运行所导致的异常缓慢;
-
fastcgi_finish_request() - 特殊功能:用于在请求完成和刷新数据后,继续在后台执行耗时的工作 (录入视频转换、统计处理等);
-
动态/静态子进程产生;
-
基本SAPI运行状态信息 (类似Apache的 mod_status);
-
基于php.ini的配置文件.
joel k
30-Jun-2011 12:56
robin at robinwinslow dot co dot uk
12-Dec-2010 10:05
Init script setup
===
You will probably want to create an init script for your new php-fpm. Fortunately, PHP 5.3.3 provides one for you, which you should copy to your init directory and change permissions:
$ cp <php-5.3.3-source-dir>/sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm
$ chmod 755 /etc/init.d/php-fpm
It requires a certain amount of setup. First of all, make sure your php-fpm.conf file is set up to create a PID file when php-fpm starts. E.g.:
----
pid = /var/run/php-fpm.pid
----
(also make sure your php-fpm user has permission to create this file).
Now open up your new init script (/etc/init.d/php-fpm) and set the variables at the top to their relevant values. E.g.:
---
prefix=
exec_prefix=
php_fpm_BIN=/sbin/php-fpm
php_fpm_CONF=/etc/php-fpm.conf
php_fpm_PID=/var/run/php-fpm.pid
---
Your init script is now ready. You should now be able to start, stop and reload php-fpm:
$ /etc/init.d/php-fpm start
$ /etc/init.d/php-fpm stop
$ /etc/init.d/php-fpm reload
The one remaining thing you may wish to do is to add your new php-fpm init script to system start-up. E.g. in CentOS:
$ /sbin/chkconfig php-fpm on
===========
Disclaimer: Although I did just do this on my own server about 20 mins ago, everything I've written here is off the top of my head, so it may not be 100% correct. Also, allow for differences in system setup. Some understanding of what you are doing is assumed.
