大约 2 个月前,我在 nginx 设置上迁移到了 php5-fpm。一切都很顺利,直到几天前,我注意到我的 php 网站没有响应(浏览器只是等待数据并最终超时)。重新启动 php5-fpm 有帮助。这是我的 /var/log/php5-fpm.log 的结尾:
[09-Feb-2013 07:22:46] NOTICE: [pool www] child 26802 started
[09-Feb-2013 20:09:07] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[10-Feb-2013 07:22:40] WARNING: [pool www] child 5986 exited on signal 11 (SIGSEGV - core dumped) after 40414.794799 seconds from start
[10-Feb-2013 07:22:40] NOTICE: [pool www] child 13596 started
[11-Feb-2013 07:22:14] WARNING: [pool www] child 23530 exited on signal 11 (SIGSEGV - core dumped) after 36419.156740 seconds from start
[11-Feb-2013 07:22:14] NOTICE: [pool www] child 31088 started
[12-Feb-2013 06:25:07 [09-Feb-2013 20:09:07] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[10-Feb-2013 07:22:40] WARNING: [pool www] child 5986 exited on signal 11 (SIGSEGV - core dumped) after 40414.794799 seconds from start
[10-Feb-2013 07:22:40] NOTICE: [pool www] child 13596 started
[11-Feb-2013 07:22:14] WARNING: [pool www] child 23530 exited on signal 11 (SIGSEGV - core dumped) after 36419.156740 seconds from start
[11-Feb-2013 07:22:14] NOTICE: [pool www] child 31088 started
[12-Feb-2013 06:25:07] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[12-Feb-2013 07:22:34] WARNING: [pool www] child 20736 exited on signal 11 (SIGSEGV - core dumped) after 3448.720422 seconds from start
[12-Feb-2013 07:22:34] NOTICE: [pool www] child 23808 started
[13-Feb-2013 06:57:30] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-Feb-2013 07:21:48] WARNING: [pool www] child 13307 exited on signal 11 (SIGSEGV - core dumped) after 1459.134695 seconds from start
[13-Feb-2013 07:21:48] NOTICE: [pool www] child 13596 started
[13-Feb-2013 08:18:13] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-Feb-2013 11:14:49] NOTICE: Finishing ...
[13-Feb-2013 11:14:49] NOTICE: exiting, bye-bye!
[13-Feb-2013 11:14:50] NOTICE: fpm is running, pid 16123
[13-Feb-2013 11:14:50] NOTICE: ready to handle connections
[13-Feb-2013 15:21:53] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[14-Feb-2013 07:22:23] WARNING: [pool www] child 27208 exited on signal 11 (SIGSEGV - core dumped) after 17743.276891 seconds from start
[14-Feb-2013 07:22:23] NOTICE: [pool www] child 31521 started
[14-Feb-2013 15:21:33] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[15-Feb-2013 07:21:51] WARNING: [pool www] child 9699 exited on signal 11 (SIGSEGV - core dumped) after 36679.697975 seconds from start
[15-Feb-2013 07:21:51] NOTICE: [pool www] child 16671 started
[15-Feb-2013 09:35:35] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[16-Feb-2013 07:22:18] WARNING: [pool www] child 29553 exited on signal 11 (SIGSEGV - core dumped) after 22986.940724 seconds from start
[16-Feb-2013 07:22:18] NOTICE: [pool www] child 1459 started
[17-Feb-2013 07:21:42] WARNING: [pool www] child 10229 exited on signal 11 (SIGSEGV - core dumped) after 45737.338223 seconds from start
[17-Feb-2013 07:21:42] NOTICE: [pool www] child 18539 started
[17-Feb-2013 08:19:01] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[17-Feb-2013 22:27:30] NOTICE: Finishing ...
[17-Feb-2013 22:27:31] NOTICE: exiting, bye-bye!
[17-Feb-2013 22:27:31] NOTICE: fpm is running, pid 24139
[17-Feb-2013 22:27:31] NOTICE: ready to handle connections] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[12-Feb-2013 07:22:34] WARNING: [pool www] child 20736 exited on signal 11 (SIGSEGV - core dumped) after 3448.720422 seconds from start
[12-Feb-2013 07:22:34] NOTICE: [pool www] child 23808 started
[13-Feb-2013 06:57:30] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-Feb-2013 07:21:48] WARNING: [pool www] child 13307 exited on signal 11 (SIGSEGV - core dumped) after 1459.134695 seconds from start
[13-Feb-2013 07:21:48] NOTICE: [pool www] child 13596 started
[13-Feb-2013 08:18:13] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-Feb-2013 11:14:49] NOTICE: Finishing ...
[13-Feb-2013 11:14:49] NOTICE: exiting, bye-bye!
[13-Feb-2013 11:14:50] NOTICE: fpm is running, pid 16123
[13-Feb-2013 11:14:50] NOTICE: ready to handle connections
[13-Feb-2013 15:21:53] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[14-Feb-2013 07:22:23] WARNING: [pool www] child 27208 exited on signal 11 (SIGSEGV - core dumped) after 17743.276891 seconds from start
[14-Feb-2013 07:22:23] NOTICE: [pool www] child 31521 started
[14-Feb-2013 15:21:33] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[15-Feb-2013 07:21:51] WARNING: [pool www] child 9699 exited on signal 11 (SIGSEGV - core dumped) after 36679.697975 seconds from start
[15-Feb-2013 07:21:51] NOTICE: [pool www] child 16671 started
[15-Feb-2013 09:35:35] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[16-Feb-2013 07:22:18] WARNING: [pool www] child 29553 exited on signal 11 (SIGSEGV - core dumped) after 22986.940724 seconds from start
[16-Feb-2013 07:22:18] NOTICE: [pool www] child 1459 started
[17-Feb-2013 07:21:42] WARNING: [pool www] child 10229 exited on signal 11 (SIGSEGV - core dumped) after 45737.338223 seconds from start
[17-Feb-2013 07:21:42] NOTICE: [pool www] child 18539 started
[17-Feb-2013 08:19:01] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[17-Feb-2013 22:27:30] NOTICE: Finishing ...
[17-Feb-2013 22:27:31] NOTICE: exiting, bye-bye!
[17-Feb-2013 22:27:31] NOTICE: fpm is running, pid 24139
[17-Feb-2013 22:27:31] NOTICE: ready to handle connections
“Finishing...” 行是我手动重启 php5-fpm 服务时出现的。我知道这没什么信息。请告诉我还需要什么。
可能存在什么问题?
答案1
此日志中显示了两个独立且不同的问题。
pm.max_children
设置得太低。这控制将生成多少个 PHP 进程来处理同时传入的请求。如果传入的请求多于可用的子进程数,则新连接必须等待……最终它们将永远等待。提高此值;在 中找到它/etc/php-fpm.d/www.conf
。这是您当前问题的实际原因,尽管您可能还没有注意到一些更为隐蔽的问题……
child ... exited on signal 11
表示 PHP 在处理请求时崩溃。取决于什么时候在处理过程中,它崩溃了,这可能没有明显的影响,或者可能导致空白页、中止传输、用户被神秘地注销等。考虑将 PHP 更新到最新的版本(5.3.x 或 5.4.x)并删除或替换已知有问题的扩展,如 APC。