- Plesk for Linux
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:
not accessible (permanently or periodically) with a 50x error in a web-browser:
PLESK_INFO: 502 Bad Gateway
PLESK_INFO: 503 Service Temporarily Unavailable
PLESK_INFO: 504 Gateway Time-outCloudflare 522 timeout error
The following message appears in the PHP-FPM error logfile
/var/log/plesk-phpXX-fpm/error.log(where XX is a PHP version used by the websites):
CONFIG_TEXT: WARNING: [pool example.com] server reached max_children setting (*), consider raising it
The message above is usually accompanied with this error:
CONFIG_TEXT: unable to read what child say: Bad file descriptor (9)
If nginx is enabled on the server, one of the following error messages may appear in domain's error logfile
CONFIG_TEXT: [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"
CONFIG_TEXT: [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:
pm.max_children has been reached by the website(s).
pm.max_children limit for the affected domains:
Connect to the Plesk server via SSH.
Find affected domains using the command below:
Note: The number on the left indicates how many times the
pm.max_childrenlimit 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 /var/www/vhosts/system/*/logs/php-fpm_error.log | cut -d' ' -f5 | tr -d ']' | sort | uniq -c | sort -nr
Go to Domains > example.com > PHP Settings > PHP-FPM Settings.
pm.max_childrenvalue 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_childrento 20. To fine tune this setting, visit this KB article.
Other options to increase the
Go to Service Plans > plan_name > PHP Settings tab > PHP-FPM Settings section.
pm.max_childrenvalue and click Update & Sync.
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.
php.inifile in domain's system directory
# touch /var/www/vhosts/system/example.com/conf/php.ini
php.inifile in any text editor (for example, vi editor) and add the following records:
pm.max_children = 20
Save the changes and close the file.
Run the following command to apply the changes:
# /usr/local/psa/bin/php_settings -u
Please sign in to leave a comment.