PHP-FPM has a built-in status page. After opening, you can view the detailed running status of PHP-FPM, which can help PHP-FPM optimization.
1. Open php-fpm.conf and configure the php-fpm status page options:
pm.status_path = /phpfpm_status //'phpfpm_status' can be customized
2. Configure nginx.conf and add server
server { listen 80; server_name 127.0.0.1; #或域名 location /phpfpm_status { fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; } }
3. Restart or reload nginx and php-fpm
- service php-fpm restart
- service nginx restart
If there is no accident, visit http://127.0.0.1/phpfpm_status to see:
Parameter Description:
- pool – fpm process pool name, mostly www
- process manager – process management method, value: static, dynamic or ondemand.dynamic
- start time - start date, if php-fpm is reloaded, the time will be updated
- start since - how long to run
- accepted conn - the number of requests accepted by the current pool
- listen queue - request waiting queue, if this value is not 0, then the number of processes in FPM may be increased
- max listen queue – the highest number of requests to wait in the queue
- listen queue len - socket wait queue length
- idle processes – the number of idle processes
- active processes – the number of active processes
- total processes – the total number of processes
- max active processes - the maximum number of active processes (counted from the start of FPM)
- max children reached - The number of times the maximum number of processes limit has been reached.
- slow requests - php-fpm slow-log enabled, the number of slow requests