Access PHP-FPM's /status page manually (bypass Apache)
Solution 1:
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