Cobra Forum

Plesk Panel => Webserver => Topic started by: Suhitha on Dec 05, 2025, 07:25 AM

Title: Websites on PHP-FPM are unavailable or loading slowly: server reached max_
Post by: Suhitha on Dec 05, 2025, 07:25 AM
Question: Websites on PHP-FPM are unavailable or loading slowly: server reached max_children setting (*), consider raising it


Applicable to:

Plesk for Linux


Symptoms

Websites that have PHP handler set as FPM application served by Apache or FPM application served by nginx at Domains > example.com > PHP Settings experience one of the following issues:

502 Bad Gateway
503 Service Temporarily Unavailable
504 Gateway Time-out
WARNING: [pool example.com] server reached max_children setting (*), consider raising it

unable to read what child say: Bad file descriptor (9)

[error] 11456#0: *118348 connect() to unix:///var/www/vhosts/system/example.com/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 203.0.113.2, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:///var/www/vhosts/system/example.com/php-fpm.sock:", host: "example.com"
[error] 20058#0: *4725139 upstream prematurely closed connection while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "POST /path/to/some/file HTTP/2.0", upstream:

Cause

The server receives a large number of requests, which leads to the PHP-FPM pm.max_children limit being reached by the website(s). This usually indicates that the server is under attack or that the number of website(s) visitors has increased sharply. Attacks or increased visitor traffic put a strain on the server's CPU, as PHP handlers that execute code begin to use the CPU more actively to process incoming requests.


Resolution

1.Ensure the server isn't under attack. You can use this article to do this:
How to diagnose a DoS/DDoS attack and find websites under attack on a Plesk server

2.If an attack has been detected, it is necessary to take measures to protect the server from attacks as described in this article: What DDoS protection tools are available in Plesk
If no attacks are detected, proceed to the next step.

3.You need to monitor the server using this article: How to monitor usage of system resources in a period of time using atop
- If the CPU and memory load are not high <60%, you can increase the parameter pm.max_children to handle more requests. You have a reserve of resources up to 80% load.
To calculate the pm.max_children Use this article: How to calculate pm.max_children value on a Plesk server?.
- If the server's processor or memory is loaded at 80% or more, it's necessary to increase the number of processor cores or the amount of RAM on the server, depending on which resource is overloaded.
Once the server resources have been expanded, you can begin to increase the parameter pm.max_children so that the server can handle more requests. To calculate the pm.max_children use this article: How to calculate pm.max_children value on a Plesk server?

Note: Increasing the limit pm.max_children should only be done after a full investigation of the server using the articles provided above.


To increase the pm.max_children limit for the affected domains:


1.Connect to the Plesk server via SSH

2.Find affected domains using the command below:

Note: The number on the left indicates how many times the pm.max_children limit has been reached by the website.

If a domain is using a dedicated FPM application and has a custom vhosts location, change the path /var/www/vhosts/system/ in the command below:

# grep -r "server reached max_children setting" /var/log/*php*-fpm/error.log | cut -d' ' -f5 | tr -d ']' | sort | uniq -c | sort -nr

100 example.com
50 example.net
25 example.org
<...>

3.Log into Plesk

4.Go to Domains > example.com > PHP Settings > PHP-FPM Settings.

5. Increase the pm.max_children value for the domain and apply the changes. Increase this value for all domains listed in step 2.

Note: In this example, we are setting pm.max_children to 20. To fine tune this setting, visit this KB article.

(https://pix.cobrasoft.org/images/2025/12/05/mceclip0-14.png)

Note: The changes will not be applied to subscriptions if:

- A subscription is not synced with this service plan (Marked with a blue lock in the Subscriptions menu).
- If the permission Hosting performance settings management is granted in service plan settings at Service Plans > plan_name > Permissions tab.


Increasing pm.max_children for all domains under a service plan via Plesk


1.Log in to Plesk.

2.Go to Service Plans > plan_name > PHP Settings tab > PHP-FPM Settings section.

3.Increase the pm.max_children value and click Update & Sync.

(https://pix.cobrasoft.org/images/2025/12/05/mceclip0-14.png)


Note: The changes will not be applied to subscriptions if:

- A subscription is not synced with this service plan (Marked with a blue lock in the Subscriptions menu).
- If the permission Hosting performance settings management is granted in service plan settings at Service Plans > plan_name > Permissions tab.


Increasing pm.max_children for one domain via a command-line interface


1.Create a php.ini file in domain's system directory /var/www/vhosts/system/example.com/conf/:

# touch /var/www/vhosts/system/example.com/conf/php.ini

2.Open the php.ini file in any text editor (for example, vi editor) and add the following records:

[php-fpm-pool-settings]
pm.max_children = 20

3.Save the changes and close the file.

4.Run the following command to apply the changes:

# /usr/local/psa/bin/php_settings -u

This is a complex administrative task that involves planning and optimizing server resources and settings. Slow code execution often also leads to timeout errors, so additional code review and optimization by developers is a good solution.