How to check fpm configuration file errors before restart
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
[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
root@localhost:~#
systemctl restart php7.4-fpm
systemctl reload php7.4-fpm
systemctl start php7.4-fpm
systemctl stop php7.4-fpm
systemd restart php7.4-fpm
systemd reload php7.4-fpm
systemd start php7.4-fpm
systemd stop php7.4-fpm
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
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
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
#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 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
max listen queue
max children reached
max active processes:
slow requests:
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
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.
How can I tell if PHP-FPM is running?
● 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
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