Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use php-fpm 's status to view details

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to use php-fpm 's status to view detailed information. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

The status of php-fpm can view summary information and details

Nginx.conf profile

Server {listen 80; server_name localhost; index index.php index.html; root / home/tinywan/zabbix; location / {try_files $uri $uri/ / index.php?$args;} location ~\ .php$ {fastcgi_pass unix:/var/run/php7.0.9-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name Include fastcgi_params;} location / nginx_status {stub_status on; access_log off; allow 127.0.0.1; # # allow 192.168.249.0 take 24; deny all;} location ~ / php_fpm-status$ {allow 127.0.0.1; # deny all Fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; include fastcgi_params; fastcgi_pass unix:/var/run/php7.0.9-fpm.sock;}}

Enable the php-fpm status feature

Tinywan@tinywan:/opt/php-7.0.9$ cat / opt/php-7.0.9/etc/php-fpm.d/www.conf | grep status_path;pm.status_path = / status

It is / status by default, but it can also be changed to something else, such as / ttlsa_status, and so on.

Vim / opt/php-7.0.9/etc/php-fpm.d/www.confpm.status_path = / php_fpm-status # removed the preceding; comment character and renamed it to php_fpm-status

After modifying php-fpm.conf, reload the configuration file using service php-fpm reload

Tinywan@tinywan:/opt/php-7.0.9$ sudo / opt/php-7.0.9/sbin/php-fpmtinywan@tinywan:/opt/php-7.0.9$ ps-aux | grep php-fpmroot 2769 4.1 0.1 212532 14676? Ss 09:50 0:00 php-fpm: master process (/ opt/php-7.0.9/etc/php-fpm.conf) tinywan 2770 3.2 0.1 212532 11084? S 09:50 0:00 php-fpm: pool wwwtinywan 2771 5.9 0.1 212532 11084? S 09:50 0:00 php-fpm: pool wwwtinywan 2773 0.0 15984 944 pts/21 S+ 09:50 0:00 grep-- color=auto php-fpm uses the curl instruction to view the status of php-fpm

Tinywan@tinywan:/usr/local/nginx$ curl localhost/php_fpm-statuspool: wwwprocess manager: dynamicstart time: 13/May/2017:09:50:43 + 0800start since: 986accepted conn: 2listen queue: 0max listen queue: 0listen queue len: 0idle processes: 1active processes: 1total processes: 2max active processes: 1max children reached: 0slow requests: 0

Php-fpm 's status can view summary information and details, which are more than the summary information about each php-fpm process. It also supports output in multiple formats, such as xml, html and json. If instructions are used by default:

Json format

Tinywan@tinywan:~$ curl localhost/php_fpm-status?json {"pool": "www", "process manager": "dynamic", "start time": 1494640243, "start since": 1609, "accepted conn": 13, "listen queue": 0, "max listen queue": 0, "listen queue len": 0, "idle processes": 1, "active processes": 1, "total processes": 2, "max active processes": 1, "max children reached": 0, "slow requests": 0}

Xml format

Tinywan@tinywan:~$ curl localhost/php_fpm-status?xmlwwwdynamic1494640243169215000112100

All formats:

Examples for summary status page: http://127.0.0.1/php_fpm-statushttp://127.0.0.1/php_fpm-status?jsonhttp://127.0.0.1/php_fpm-status?htmlhttp://127.0.0.1/php_fpm-status?xmlExample for detailed status page: http://127.0.0.1/php_fpm-status?fullhttp://127.0.0.1/php_fpm-status?json& Full http://127.0.0.1/php_fpm-status?html&fullhttp://127.0.0.1/php_fpm-status?xml&full

Screenshots of browsers accessing xml files

The meaning of php-fpm status

Field meaning the name of poolphp-fpm pool, which in most cases is managed by the wwwprocess manager process. Nowadays, most of them are dynamic. Do not use the time when staticstart timephp-fpm was last started. How many seconds has start sincephp-fpm run? the number of requests received by accepted connpool. The number of connections listen queue is waiting for, if not 0. Need to increase the number of php-fpm processes max listen queue from php-fpm startup to now waiting for connections the maximum number of socket size listen queue len waiting for connection queue the number of processes idle processes idle active processes the total number of total processess processes max active process has been active since php-fpm started up to now a maximum of several processes are active max children reached when pm tries to start more children processes However, it reaches the limit of the number of processes to be recorded once at a time. If it is not 0, the maximum number of php-fpm pool processes needs to be increased. Slow requests when php-fpm slow-log is enabled, if there is a php-fpm slow request, this counter will increase, and generally inappropriate Mysql queries will trigger this value. This is the end of the article on "how to use php-fpm 's status View details". Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report