php-fpm 状态页面不显示有关空闲进程的信息

php-fpm 状态页面不显示有关空闲进程的信息

我的机器上运行着 PHP 5.6 和 PHP 7.3。Web 服务器是 Nginx,使用 FastCGI (php-fpm)。我设置了两个 php-fpm 状态页面 - 一个用于 php-fpm 5.6 的 www 池,另一个用于 php-fpm 7.3 的 www 池。

5.6 版的状态页面运行正常并给出所需的输出:

pool:                 www
process manager:      static
start time:           29/Apr/2021:17:12:19 +0200
start since:          2870
accepted conn:        154
listen queue:         0
max listen queue:     1
listen queue len:     128
idle processes:       4
active processes:     1
total processes:      5
max active processes: 2
max children reached: 0
slow requests:        0

************************
pid:                  9209
state:                Idle
start time:           29/Apr/2021:17:12:19 +0200
start since:          2870
requests:             32
request duration:     331468
request method:       GET
request URI:          /index.php?q=test-page
content length:       0
user:                 -
script:               /data/www56/test/index.php
last request cpu:     48.27
last request memory:  26214400

************************
pid:                  9214
state:                Running
start time:           29/Apr/2021:17:12:19 +0200
start since:          2870
requests:             31
request duration:     107
request method:       GET
request URI:          /php56_status?full
content length:       0
user:                 -
script:               /data/www56/test/php56_status
last request cpu:     0.00
last request memory:  0

另一方面,7.3 版本的状态页面有一些奇怪的行为 - 请求信息(例如方法、URI 或脚本)未显示在闲置的进程。这些信息仅显示在跑步此 php-fpm 7.3 池上的进程:

pool:                 www
process manager:      static
start time:           29/Apr/2021:17:41:56 +0200
start since:          1062
accepted conn:        45
listen queue:         0
max listen queue:     1
listen queue len:     128
idle processes:       4
active processes:     1
total processes:      5
max active processes: 2
max children reached: 0
slow requests:        0

************************
pid:                  9003
state:                Idle
start time:           29/Apr/2021:17:41:56 +0200
start since:          1062
requests:             9
request duration:     201048
request method:       -
request URI:          -
content length:       0
user:                 -
script:               -
last request cpu:     19.90
last request memory:  4194304

************************
pid:                  9006
state:                Running
start time:           29/Apr/2021:17:41:56 +0200
start since:          1062
requests:             8
request duration:     140
request method:       GET
request URI:          /php73_status?full
content length:       0
user:                 -
script:               /data/www73/test/php73_status
last request cpu:     0.00
last request memory:  0

两个状态页面的 Nginx 配置相同:

#php5.6
location /php56_status {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_intercept_errors on;
        fastcgi_connect_timeout 300s;
        fastcgi_read_timeout 300s;
        fastcgi_send_timeout 300s;
        fastcgi_keep_conn on;
}

#php7.3
location /php73_status {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        fastcgi_intercept_errors on;
        fastcgi_connect_timeout 300s;
        fastcgi_read_timeout 300s;
        fastcgi_send_timeout 300s;
        fastcgi_keep_conn on;
}

两者的池配置相同(默认 www.conf),php-fpm 配置也相同(默认 php-fpm.conf)。fastcgi_params文件内容:

fastcgi_param   QUERY_STRING            $query_string;
fastcgi_param   REQUEST_METHOD          $request_method;
fastcgi_param   CONTENT_TYPE            $content_type;
fastcgi_param   CONTENT_LENGTH          $content_length;

fastcgi_param   SCRIPT_FILENAME         $request_filename;
fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
fastcgi_param   REQUEST_URI             $request_uri;
fastcgi_param   DOCUMENT_URI            $document_uri;
fastcgi_param   DOCUMENT_ROOT           $document_root;
fastcgi_param   SERVER_PROTOCOL         $server_protocol;

fastcgi_param   GATEWAY_INTERFACE       CGI/1.1;
#fastcgi_param  SERVER_SOFTWARE         nginx/$nginx_version;
fastcgi_param   SERVER_SOFTWARE         nginx;

fastcgi_param   REMOTE_ADDR             $remote_addr;
fastcgi_param   REMOTE_PORT             $remote_port;
fastcgi_param   SERVER_ADDR             $server_addr;
fastcgi_param   SERVER_PORT             $server_port;
fastcgi_param   SERVER_NAME             $server_name;

fastcgi_param   HTTPS                   $https if_not_empty;

当我无法访问有关已结束进程的信息时(在 php-fpm 5.6 中是可能的),它就没用了。在 php-fpm 7.3 中是否可以显示有关空闲工作进程及其最后处理的脚本的信息?或者我在这里做错了什么或遗漏了什么,导致它无法正常工作?

谢谢你!

相关内容