• Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / nginx server tutorials (installation, configuration, performance tuning, security) / php fpm restart nginx ubuntu enable status page, monitor etc

php fpm restart nginx ubuntu enable status page, monitor etc

Table of Contents

Toggle
  • How to check fpm configuration file errors before restart
  • php fpm config test for syntax errors
  • How restart Php fpm ubuntu Debian
  • How to Enable and Monitor PHP-FPM Status in Nginx
    • #1 edit the pho-fpm conf file
  • #2 edit nginx default conf add this code
  • #3 restart reload nginx
    • #4 check status page
    • #5 understanding php-fpm status page report
  • max listen queue
    • max children reached
    • max active processes:
    • slow requests:
  • 504 gateway time out nginx php fpm
  • Faqs on Php fpm
    • how to restart php fpm ubuntu?
    • what is php fpm?
  • How can I tell if PHP-FPM is running?
    • ps aux | grep php

How to check fpm configuration file errors before restart

php-fpm7.4 -t

 

root@localhost:~# php-fpm7.4 -t
[30-Jul-2021 17:05:34] NOTICE: configuration file /etc/php/7.4/fpm/php-fpm.conf test is successful

php fpm config test for syntax errors

root@murali:~# php-fpm8.1 -t
[18-Jul-2023 04:29:08] NOTICE: configuration file /etc/php/8.1/fpm/php-fpm.conf test is successful

How restart Php fpm ubuntu Debian

service php7.4-fpm restart
service php7.4-fpm reload
root@localhost:~# service php7.4-fpm reload
root@localhost:~#
or

systemctl restart php7.4-fpm

systemctl reload php7.4-fpm

systemctl start php7.4-fpm

systemctl stop php7.4-fpm

or

systemd restart php7.4-fpm

systemd reload php7.4-fpm

systemd start php7.4-fpm

systemd stop php7.4-fpm

Prerequisites:
#1: understand php – fpm pool configuration

How to Enable and Monitor PHP-FPM Status in Nginx

#1 edit the pho-fpm conf file

nano /etc/php/7.3/fpm/pool.d/www.conf
uncoment
pm.status /status
check for syntax errors & restart php fpm
sudo php7.3-fpm -t && sudo systemctl restart php7.3-fpm

#2 edit nginx default conf add this code

$ sudo nano /etc/nginx/conf.d/default.conf
location ~ ^/(status|ping)$ {
        allow 127.0.0.1;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
        #fastcgi_pass 127.0.0.1:9000;
        fastcgi_pass   unix:/var/run/php7.3-fpm.sock;
}

#3 restart reload nginx

$ sudo systemctl restart nginx
nginx -s reload

#4 check status page

ip-address/status
or
domain/status
pool:                 www
process manager:      dynamic
start time:           02/Apr/2021:19:16:20 +0000
start since:          1588836
accepted conn:        189149
listen queue:         0
max listen queue:     19
listen queue len:     65536
idle processes:       15
active processes:     1
total processes:      16
max active processes: 31
max children reached: 0
slow requests:        0
http://www.foo.bar/status?full
pool:                 www
process manager:      dynamic
start time:           02/Apr/2021:19:16:20 +0000
start since:          1589136
accepted conn:        189184
listen queue:         0
max listen queue:     19
listen queue len:     65536
idle processes:       15
active processes:     1
total processes:      16
max active processes: 31
max children reached: 0
slow requests:        0

************************
pid:                  28970
state:                Idle
start time:           17/Apr/2021:05:04:18 +0000
start since:          344258
requests:             2510
request duration:     108062
request method:       POST
request URI:          /wp-admin/admin-ajax.php
content length:       6490
user:                 -
script:               /var/www/html/rajuginni.com/wp-admin/admin-ajax.php
last request cpu:     74.03
last request memory:  2097152

************************
pid:                  28874
state:                Idle
start time:           17/Apr/2021:04:51:08 +0000
start since:          345048
requests:             2541
request duration:     114807
request method:       GET
request URI:          /index.php
content length:       0
user:                 -
script:               /var/www/html/raju/index.php
last request cpu:     60.97
last request memory:  2097152

************************
pid:                  2205
state:                Idle
start time:           20/Apr/2021:11:57:32 +0000
start since:          60264
requests:             425
request duration:     355489
request method:       POST
request URI:          /wp-cron.php?doing_wp_cron=1618980078.5080909729003906250000
content length:       0
user:                 -
script:               /var/www/html/sarkariresultz.in/wp-cron.php
last request cpu:     61.89
last request memory:  12582912

************************
pid:                  28951
state:                Idle
start time:           17/Apr/2021:05:03:05 +0000
start since:          344331
requests:             2522
request duration:     130015
request method:       POST
request URI:          /wp-admin/admin-ajax.php
content length:       67
user:                 -
script:               /var/www/html/rajuginni.com/wp-admin/admin-ajax.php
last request cpu:     69.22
last request memory:  2097152

************************
pid:                  28964
state:                Idle
start time:           17/Apr/2021:05:04:16 +0000
start since:          344260
requests:             2512
request duration:     384968
request method:       GET
request URI:          /index.php
content length:       0
user:                 -
script:               /var/www/html/sarkariresultz.in/index.php
last request cpu:     77.93
last request memory:  31457280

************************
pid:                  28975
state:                Idle
start time:           17/Apr/2021:05:04:23 +0000
start since:          344253
requests:             2502
request duration:     5912
request method:       GET
request URI:          /index.php
content length:       0
user:                 -
script:               /var/www/html/jojowealth.com/index.php
last request cpu:     169.15
last request memory:  2097152


************************
pid:                  28859
state:                Running
start time:           17/Apr/2021:04:50:59 +0000
start since:          345057
requests:             2540
request duration:     3227
request method:       GET
request URI:          /status?full
content length:       0
user:                 -
script:               -
last request cpu:     0.00
last request memory:  0
http://php-fpm-status/status?html&full   html status page god
php fpm status page html
json,xml options available to pull the data

#5 understanding php-fpm status page report

pool www
process manager dynamic
start time 14/Jul/2020:16:12:35 +0000
start since 43224     // number of seconds since the process has started.
accepted conn 3384    // accepted request from nginx
listen queue current ques
max listen queue maximum queue still server start  requests in the queue of pending connections
listen queue len maximum length 65536 .. sysctl conf has to modify
idle processes 2
active processes 1
total processes 3
max active processes 3    // max active processes still the server started
max children reached 0  // how many times its reached max process increase (php fpm pool configuration)
slow requests 0   // you have enable first also available at /var/log/phpslow
request duration – in microseconds (1000th of milli second)
request method – GET, POST,
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
idle process wastes memory.
php -fpm is a single thread application just like nginx and redis but mysql multi threaded.

max listen queue

maximum number of requests queued for processed until server restart.

max children reached

how many times php-fpm reached its limit.
if reached you can increase child process limits.
by cost memory.

max active processes:

total 5 severs.
3 process reached per seconds.(3 concurrent request per second)
most of wp pages served by fastcgi cache nginx. or cloudflare proxy.
mysql connections per seconds should higher than php-fpm max children per second.
also monitor  nginx connections per second With nginx stub status module (not in core)

slow requests:

#6 enable slow request in php-fpm
edit www.conf
threshold should be 1sec
slow query log path
uncomment all
restart or reload php fpm
then you see slow queries in php fpm status page.

504 gateway time out nginx php fpm

 

edit php.ini max_execution_time 60seconds to 300ms (5 minutes)

and edit . gninx.conf

add fastcgi read timeout to 300 seconds.

mysql max execution time is always by default.

Faqs on Php fpm

how to restart php fpm ubuntu?

 

first check syntax errors

php-fpm7.4 -t

Sudo service php-fpm restart
or version specific
sudo service php7.4-fpm restart
sudo service php8.0-fpm restart
restart php fpm using systemctl ubuntu debian
systemctl restart php7.4-fpm

what is php fpm?

CGI and FastCGI are two protocols not specific to PHP:

CGI scripts is a way how to run a server side script (not only PHP!) when a HTTP request arrives. In this setup, the web server launches a new CGI process for every incoming request, causing significant performance overhead.

FastCGI is a “better CGI” – to address the limitations of CGI, the FastCGI runs as a server (TCP or UNIX), so that resources can be reused across requests.

PHP-FPM is PHP’s FastCGI implementation – works with apache  enable mod_fastcgi and disable mod_php.
What is System PHP-FPM status?
PHP-FPM has a very useful built-in status page. You can access it over web and also write scripts to monitor your PHP-FPM sites health remotely.

How can I tell if PHP-FPM is running?

just check status of php -fpm status
sudo service php7.4-fpm status
root@-s-4vcpu-8gb-blr1-01:~# sudo service php7.4-fpm status
● php7.4-fpm.service – The PHP 7.4 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor prese
Active: active (running) since Fri 2021-04-02 19:16:20 UTC; 2 weeks 4 days ag
Docs: man:php-fpm7.4(8)
Process: 28325 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php
Process: 28369 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/p
Main PID: 28327 (php-fpm7.4)
Status: “Processes active: 0, idle: 16, Requests: 189467, slow: 0, Traffic: 0
Tasks: 17 (limit: 4915)
CGroup: /system.slice/php7.4-fpm.service
├─ 1338 php-fpm: pool www
├─ 2202 php-fpm: pool www
├─ 2205 php-fpm: pool www
├─ 2206 php-fpm: pool www
├─28327 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
├─28859 php-fpm: pool www
├─28868 php-fpm: pool www
├─28869 php-fpm: pool www
├─28874 php-fpm: pool www
├─28881 php-fpm: pool www
├─28951 php-fpm: pool www
├─28964 php-fpm: pool www
├─28970 php-fpm: pool www
lines 1-23
sudo service php-fpm status (not works because you need version) so use grep command

ps aux | grep php

root@-s-4vcpu-8gb-blr1-01:~# ps aux | grep php
www-data 1338 0.1 5.5 918960 454568 ? S Apr17 6:35 php-fpm: pool www
www-data 2202 0.1 4.9 906464 401556 ? S Apr20 1:22 php-fpm: pool www

nginx server tutorials (installation, configuration, performance tuning, security)

  • Letsencrypt SSL Installation on apache/Nginx ubuntu / debian wordpress
  • fix error 520 522 524 on cloudflare wordpress godaddy nginx etc
  • nginx fastcgi cache wordpress how to configure
  • install LEMP Stack on 22.04 LTS Nginx MySQL PHP fpm #wordpress #digital ocean
  • Apache vs nginx (connection handling, modules, memory usage)
  • Pagespeed module install, configure, monitor, errors ft nginx &apache
  • nginx errors (504,502, 413, unable to start, syntax errors)
  • nginx conf explained best config file performance tuning tips nginx.conf location errors tutorial
  • use nginx as reverse proxy and load balancer for apache wordpress
  • nginx rewrite rules with examples 301 redirection
  • nginx modules list (enable, disable, upgrade, install dynamic module)
  • php fpm pool manager configuration settings based on server spike high cpu wordpress
  • php fpm restart nginx ubuntu enable status page, monitor etc
  • what is TTFB & how to Reduce it (server response time) Google pagespeed
  • letsencrypt install configure on ubuntu / debian nginx
  • Top 10 tips to improve nginx server security
  • nginx performance tuning connections, buffers file descriptors
  • enable brotli compression nginx brotli vs gzip
  • nginx installation on ubuntu 20.04 LTS
  • monitor nginx request with nginx status amplify datadog new relic
  • SSL faster reduce TLS hand shake improve https performance
  • nginx rate limiting explained by location time specific url
  • datadog nginx integration installation process
  • newrelic nginx integration process and errors fix and metrics
  • php fpm seems busy fixed warning and max children reached to handle max connections / requests
  • Php fpm configuration for 1000 concurrent connections server busy max children reached
  • php fpm ondemand vs dynamic vs Static (the dynamic pool problem)
  • nginx upstream response is buffered to a temporary file
  • php fpm install ubuntu 20.04 nginx
  • install phpmyadmin ubuntu nginx 22.04
  • upgrade php fpm ubuntu nginx 7.4 to 8.2
  • nginx add last modified header (remove, php wordpress)
  • php fpm dynamic pool manager settings
  • nginx fastcgi cache purge
  • nginx open file limit connections ulimits sysctl
  • php fpm high cpu usage WordPress 4 solutions nay work for you
  • nginx buffer size for wordpress
  • Cloudflare error code 524 nginx a timeout error occured
  • server configuration for 1000 concurrent users

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy