php-fpm status can view summary information and detailed information
nginx.conf configuration file
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/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 php-fpm status function
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
The default is /status, but of course it can be changed to other values, such as /ttlsa_status, etc.
vim /opt/php-7.0.9/etc/php-fpm.d/www.conf pm.status_path = /php_fpm-status #去掉了前面的;注释符,并更名为php_fpm-status
After modifying php-fpm.conf, use service php-fpm reload to reload the configuration file
tinywan@tinywan:/opt/php-7.0.9$ sudo /opt/php-7.0.9/sbin/php-fpm tinywan@tinywan:/opt/php-7.0.9$ ps -aux | grep php-fpm root 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 www tinywan 2771 5.9 0.1 212532 11084 ? S 09:50 0:00 php-fpm: pool www tinywan 2773 0.0 0.0 15984 944 pts/21 S+ 09:50 0:00 grep --color=auto php-fpm
Use the curl command to view the status of php-fpm
tinywan@tinywan:/usr/local/nginx$ curl localhost/php_fpm-status pool: www process manager: dynamic start time: 13/May/2017:09:50:43 +0800 start since: 986 accepted conn: 2 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
php-fpm status can view summary information and detailed information. The detailed information has more information about each php-fpm process than the summary information. It also supports multiple format output, such as xml, html and json. By default Just use the if command respectively:
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?xml <?xml version="1.0" ?> <status> <pool>www</pool> <process-manager>dynamic</process-manager> <start-time>1494640243</start-time> <start-since>1692</start-since> <accepted-conn>15</accepted-conn> <listen-queue>0</listen-queue> <max-listen-queue>0</max-listen-queue> <listen-queue-len>0</listen-queue-len> <idle-processes>1</idle-processes> <active-processes>1</active-processes> <total-processes>2</total-processes> <max-active-processes>1</max-active-processes> <max-children-reached>0</max-children-reached> <slow-requests>0</slow-requests> </status>
All formats:
Examples for summary status page: http://127.0.0.1/php_fpm-status http://127.0.0.1/php_fpm-status?json http://127.0.0.1/php_fpm-status?html http://127.0.0.1/php_fpm-status?xml Example for detailed status page: http://127.0.0.1/php_fpm-status?full http://127.0.0.1/php_fpm-status?json&full http://127.0.0.1/php_fpm-status?html&full http://127.0.0.1/php_fpm-status?xml&full
Browser access xml file screenshot
The meaning of php-fpm status
##Field | Meaning |
---|---|
pool | php-fpm pool name, In most cases, it is www |
process manager | process management method. Most of them are dynamic nowadays. Do not use it. static |
start time | php-fpm last started time |
start since | How many seconds has php-fpm been running |
accepted conn | The number of requests received by the pool |
listen queue | The number of connections in the waiting state. If it is not 0, you need to increase the number of php-fpm processes |
max listen queue | The maximum number of connections waiting from php-fpm startup to now |
listen queue len | Size of sockets waiting for connection queue |
idle processes | Number of idle processes |
active processes | Number of active processes |
total processess | Total processes |
The maximum number of processes that have been active since php-fpm was started | |
When pm tried to start more children processes, it reached the limit of the number of processes and recorded once. If it is not 0, you need to increase the maximum number of php-fpm pool processes | |
When the php-fpm slow-log function is enabled, if a php-fpm slow request occurs, this counter will increase, generally inappropriate Mysql queries This value will be triggered |
The above is the detailed content of Teach you how to use php-fpm status to view detailed information. For more information, please follow other related articles on the PHP Chinese website!

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP makes it easy to create interactive web content. 1) Dynamically generate content by embedding HTML and display it in real time based on user input or database data. 2) Process form submission and generate dynamic output to ensure that htmlspecialchars is used to prevent XSS. 3) Use MySQL to create a user registration system, and use password_hash and preprocessing statements to enhance security. Mastering these techniques will improve the efficiency of web development.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor