PHP-FPM Common Configuration

Source: Internet
Author: User

Process PM Configuration:

PHP-FPM Sub-process is improperly set up to cause server 502, which is usually a sub-program supercritical value, resulting in partial request exception.

There are three modes of the PHP-FPM child process:


Static static mode, which opens the fixed child process at startup.

Affected Parameters:

Pm.max_children Specifies the number of child processes to create.

Description: This mode sub-process overhead is fixed, applicable to the situation where the volume of requests is small.


Dynamic dynamic mode, start fixed the least kid process.

Affected Parameters:

Pm.max_children Specifies the maximum number of child processes.

pm.start_servers Specifies the number of child processes that are turned on at startup, the default value =min_spare_servers + (max_spare_servers-min_spare_servers)/2

pm.min_spare_servers allows the minimum number of idle child processes to be created automatically if the idle child process is less than.

pm.max_spare_servers allows the maximum number of idle child processes to be killed if the idle child process is greater than.

Note: This mode is not immediately released after processing the request, convenient to quickly process the next request, reasonable set of idle subroutine to facilitate rapid response, too large idle child process can cause memory and other resources wasted. Number of processes in this mode = Idle process + processing process.


OnDemand on-demand mode, no child processes are created at startup, and child processes are automatically incremented as requested.

Affected Parameters:

Pm.max_children Specifies the maximum number of child processes.

pm.process_idle_timeout Specifies the maximum time to live idle processes, with a default value of 10s.

Description: In this mode, the child process automatically increases according to the request volume and sets the time to live for all idle subroutines, which saves resources, but creates subroutines at the same time when high concurrent requests affect response speed.


Log configuration:

Access.log Specifies the access log file, which does not write the access log by default.

Slowlog Specifies the slow request log file, which does not write the log by default, enabling this log to find code that is too slow for the system request.

request_slowlog_timeout Specifies a slow-request time comparison value, which defaults to 0 for no slow request.

request_terminate_timeout Specifies the time comparison value for slow kill, which defaults to 0 for no slow kill.


This article is from the "gangbusters" blog, make sure to keep this source http://php2012web.blog.51cto.com/5585213/1920072

PHP-FPM Common Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.