How to Enable and Monitor PHP-FPM Status in Nginx

PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation that comes with a number of extra features useful for websites of any size, particularly sites that receive high traffic.

It is commonly used in the LEMP (Linux Nginx MySQL/MariaDB PHP) stack; Nginx uses PHP FastCGI for serving dynamic HTTP content on a network. It is being used to serve millions of PHP requests for hundreds of websites on web servers on the internet.

Read Also: How to Enable NGINX Status Page

One of the useful features of php-fpm is the built-in status page, which can help you monitor its health. In this article, we will show how to enable the PHP-FPM status page on Linux.

How to Enable PHP-FPM Status Page in Linux

First open the php-fpm configuration file and enable the status page as shown.

$ sudo vim /etc/php-fpm.d/www.conf 
$ sudo vim /etc/php/7.2/fpm/pool.d/www.conf	#for PHP versions 5.6, 7.0, 7.1

Inside this file, find and uncomment the variable pm.status_path = /status as shown in the screenshot.

Enable PHP-FPM Status Page
Enable PHP-FPM Status Page

Save the changes and exit the file.

Next, check that the PHP-FPM configuration file for any errors by running the command below.

$ sudo php-fpm -t
$ sudo php7.2-fpm -t
Check PHP-FPM Configuration File
Check PHP-FPM Configuration File

Then restart the PHP-FPM service to apply the recent changes.

$ sudo systemctl restart php-fpm
$ sudo systemctl restart php7.2-fpm

Next, edit your default server block (virtual host) configuration file and add the location block below in it. For instance on the test system, the default server block’s config file is /etc/nginx/conf.d/default.conf, for the site test.lab.

$ sudo vim /etc/nginx/conf.d/default.conf 

Here is the location block to be added. In this config, we have only allowed access to PHP-FPM process status within the localhost using the directive allow for security reasons.

location ~ ^/(status|ping)$ {
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_pass   unix:/var/run/php7.2-fpm.sock;

Save the file and close it.

Then restart the Nginx server to apply the above changes.

$ sudo systemctl restart nginx

Now open a browser and type the URL http://test.lab/status to view your PHP-FPM process status.

View PHP-FPM Status Page
View PHP-FPM Status Page

Alternatively, use the curl program as follows, where the -L flag specifies the location of the page.

$ curl -L http://test.lab/status

By default, the status page only prints out a summary or short status. To view status for each pool process, pass “full” in the query string, for instance:

You can define the output format (JSON, HTML or XML) as shown.

Below are the values returned in the php-fpm full status, for each process:

  • pid – PID of the process.
  • state process status (idle, running, etc.).
  • start time – date and time the process has started.
  • start since – number of seconds since the process has started.
  • requests – number of requests the process has served.
  • request duration – duration in µs of the requests.
  • request method – request method (GET, POST, etc.).
  • request URI – request URI with the query string.
  • content length – content length of the request (only with POST).
  • user – user (PHP_AUTH_USER) (or ‘-‘ if not set).
  • script – main script called (or ‘-‘ if not set).
  • last request cpu – %cpu the last request consumed (note that it’s always 0 if the process is not in Idle state).
  • last request memory – max amount of memory the last request consumed (it’s always 0 if the process is not in Idle state).

That’s it for now! In this article, we have explained how to enable the php-fpm status page under Nginx web server. Use the feedback form below to share your thoughts with us.

Tutorial Feedback...
Was this article helpful? If you don't find this article helpful or found some outdated info, issue or a typo, do post your valuable feedback or suggestions in the comments to help improve this article...

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

2 thoughts on “How to Enable and Monitor PHP-FPM Status in Nginx”

  1. You can just use this ‘PHP-FPM real-time status page’ script without any configuration:

  2. I’m getting a blank page.

    on access.log it is ok.

    on error.log nothing is recorded.

    location = /php-fpm-status {
    #     access_log off;
    #     deny all;
         include fastcgi_params;
    #     fastcgi_pass;
          fastcgi_pass unix:/run/php/php7.0-fpm.sock;

    When I insert these two lines:

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_index index.php;

    I start to get an error on error.log:

    2020/07/23 21:50:24 [error] 11585#11585: *71685 FastCGI sent in stderr: "Access to the script '/usr/share/nginx/html/php-fpm-status' has been denied (see security.limit_extensions)" while reading response header from upstream, client:, server: _, request: "GET /php-fpm-status HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: ""

    security.limit_extensions is default to .php.

    Any ideas?


Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.