Server Monitoring2 min read

    How to Monitor PHP-FPM

    Share

    Overview

    PHP-FPM (FastCGI Process Manager) is the most widely used PHP process manager for serving PHP applications behind Nginx or Apache. Xitoring's PHP-FPM integration gives you real-time visibility into process pool health, request throughput, and resource consumption.

    What Can It Monitor?

    • Active Processes — Worker processes currently handling requests
    • Idle Processes — Worker processes waiting for requests
    • Request CPU — CPU usage per request
    • Request Memory — Memory usage per request
    • Listen Queue — Requests waiting for a free worker
    • Max Listen Queue — Peak queue length since last restart
    • Slow Requests — Requests exceeding the slow log threshold
    • Total Processes — Combined active + idle workers
    • Max Active Processes — Peak concurrent workers since last restart

    Prerequisites

    You need to enable PHP-FPM's built-in status page before activating the integration.

    On Linux

    Edit your PHP-FPM pool configuration (e.g., /etc/php/php-fpm.d/www.conf) and uncomment these lines:

    pm.status_path = /fpm/status
    ping.path = /fpm/ping
    

    Restart PHP-FPM:

    sudo systemctl restart php-fpm
    

    On Windows

    Edit C:\Program Files\PHP\v7.X\php-fpm.d\www.conf and uncomment the same lines:

    pm.status_path = /fpm/status
    ping.path = /fpm/ping
    

    Restart the service:

    Restart-Service -Name php-fpm
    

    Configure Your Web Server

    Nginx

    Add this location block to serve the status page locally:

    location ~ ^/fpm/(status|ping)$ {
        allow 127.0.0.1;
        deny all;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php-fpm/www.sock;
    }
    

    Apache

    Add a proxy configuration for the status endpoint:

    <Location /status>
        ProxyPass unix:/var/run/php-fpm.sock|fcgi://localhost/status
        ProxyPassReverse unix:/var/run/php-fpm.sock|fcgi://localhost/status
        ProxyRequests Off
        AllowOverride None
        Require local
    </Location>
    

    Tip: Replace socket paths with values appropriate for your server setup.

    How to Activate the Integration

    Run the Xitogent CLI:

    xitogent integrate
    

    Select PHP-FPM from the list. When prompted, enter the URL where the status page is served:

    http://127.0.0.1/fpm/status
    

    Setting Up Triggers

    Available trigger parameters:

    • Active Processes / Idle Processes
    • Request CPU / Request Memory
    • Listen Queue
    • Slow Requests
    • Total Processes

    Navigate to Triggers on your server page, select PHP-FPM, choose the metric, set thresholds, and configure your notification channels.

    Tips

    • Monitor Listen Queue — a growing queue means you need more workers
    • Set alerts on Active Processes to detect when your pool is saturated
    • Track Slow Requests to identify performance bottlenecks in your PHP code
    • Keep the status endpoint restricted to localhost for security
    • Works on both Linux and Windows servers