PHP-FPM Status Page via FCGI (no browser required)

March 18, 2021 Stanly G Linux, PHP 0 minutes, 48 seconds

You can retrive the php-fpm status page without using Apache (or Nginx)

First, update the php-fpm configuration file:

pm.status_path=/fpm-status

Then, install the cgi-fcgi program from libfcgi or other package.

Then, simply ask cgi-fcgi to call PHP-FPM for you, using the appropriate socket file:

SCRIPT_NAME=/fpm-status SCRIPT_FILENAME=/fpm-status REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php/www.sock

Expected output:

Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Content-type: text/plain;charset=UTF-8

pool:                 example.com
process manager:      static
start time:           18/Mar/2020:12:00:00 -0000
start since:          945
accepted conn:        2004
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       119
active processes:     1
total processes:      120
max active processes: 5
max children reached: 0
slow requests:        0

For more details, you can ask for the full status page:

SCRIPT_NAME=/fpm-status SCRIPT_FILENAME=/fpm-status QUERY_STRING=full REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php/www.sock

Other options can be changed in the Query String, read the php-fpm.conf file (or a commented version) for details of supported options, such as html, xml, json, and full.