nginx php-fpm 子进程退出,代码为 0

bus*_*usy 5 freebsd php nginx php-fpm php7

任何人都对 php-fpm 7 和 11.0-RELEASE-p8 有类似的问题,或者知道如何调试它?

几分钟后情况开始,只向客户显示半页。任何页面都显示约 62kb 的内容并带有结尾????????? 4.

php-fpm 的日志文件:

[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80582 exited with code 0 after 0.005648 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80584 started
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80583 exited with code 0 after 0.005877 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80585 started
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80581 exited with code 0 after 0.007763 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80586 started
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80585 exited with code 0 after 0.005653 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80587 started
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80586 exited with code 0 after 0.005820 seconds from start
[18-Mar-2017 15:41:49] NOTICE: [pool www] child 80588 started
Run Code Online (Sandbox Code Playgroud)

PHP配置:

$php -v
PHP 7.0.17 (cli) (built: Mar 17 2017 02:07:44) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.17, Copyright (c) 1999-2017, by Zend Technologies
Run Code Online (Sandbox Code Playgroud)

PHP-FPM.conf

pm = dynamic
pm.max_children = 25
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 3
pm.max_requests = 0 ;changing to 500
Run Code Online (Sandbox Code Playgroud)

bus*_*usy 6

在代码中使用 exec 函数时,这是 php-fpm 错误。好的做法是阻止它们,这样就不会产生这样的问题。

https://bugs.php.net/bug.php?id=73342

错误在过去 4 年中是开放的。


Pau*_*ghi 6

首先,这是预期的行为。这些消息被标记为 NOTICE,这是 php-fpm.conf 中的默认值:

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice
Run Code Online (Sandbox Code Playgroud)

当 pm.max_requests 选项在您的 php-fpm 配置文件中定义时,进程正在退出并重新生成。

例如:

; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 500
Run Code Online (Sandbox Code Playgroud)

如果在本例中定义为 500,则 php-fpm 在处理 500 个请求后会回收该进程。实际上,您可以忽略这些消息,因为它们是无害的,只是提供信息。

如果你不希望记录这些信息做什么,只是改变你的日志级别以上的东西notice,像warning