11

There is a PHP5.3.3 bug that won't allow me to view php-fpm's /status page via Apache2. Is there a way to manually access this data? I cannot upgrade the box (Ubuntu 10.10, php5.3.4 not supported).

I've tried connecting using the technique here: http://inode.co.nz/testing-a-fastcgi-service, but no luck.

2 Answers 2

14

In order to load the /status page, you must have certain environment variables set, specifically: SCRIPT_NAME, SCRIPT_FILENAME, QUERY_STRING, and REQUEST_METHOD. You do not need DOCUMENT_ROOT (even for a normal request).

Under the correct pool (it is not a global setting) of your php-fpm config set (or uncomment):

pm.status_path = /status

Then run (replacing PORT):

SCRIPT_NAME=/status \
SCRIPT_FILENAME=/status \
QUERY_STRING= \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect 127.0.0.1:PORT

Sample Output:

X-Powered-By: PHP/5.3.9
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Content-Type: text/plain

pool:                 web1
process manager:      dynamic
start time:           28/Jan/2012:20:49:44 -0500
start since:          5955
accepted conn:        41
listen queue:         0
max listen queue:     0
listen queue len:     128
idle processes:       1
active processes:     1
total processes:      2
max active processes: 1
max children reached: 0

Note: the results are pool specific.

Tested on a RHEL/CentOS 6 system with PHP v5.3.9.

(Side point of mention for people using CentOS - the package that provides cgi-fcgi is named fcgi and available from EPEL)

As an aside, the same can be achieved with ping:

Set: ping.path = /ping (php-fpm config)

SCRIPT_NAME=/ping\
SCRIPT_FILENAME=/ping\
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect 127.0.0.1:PORT

Or for a regular PHP file (you have to use the full path, QUERY_STRING is optional):

SCRIPT_NAME=/test.php \
SCRIPT_FILENAME=/var/www/path/to/test.php \
QUERY_STRING= \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect 127.0.0.1:PORT
1
  • IT WORKED!!! I had tried every iteration of (REQUEST_METHOD and DOCUMENT_ROOT and (SCRIPT_NAME or SCRIPT_FILENAME)). Thank you incredibly.
    – mikewaters
    Jan 29, 2012 at 16:05
0

On newer ubuntu (e.g. 20), install the libfcgi-bin package apt install libfcgi-bin to get the cgi-fcgi command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .