Websites on PHP-FPM are unavailable or loading slowly: "server reached max_children setting" OR "pool seems busy"




  • Avatar
    Markus Wernecke

    Great help and tutorial ! Thanks a lot

  • Avatar
    Sharul Hafiz

    Possible to apply this setting to all domains with single file editing? I have lots of domains to be configured 1 by 1

  • Avatar
    Nikolay Zhmuk

    @Sharul Hafiz You can check the article mentioned in Additional Information section -
    Keep in mind that increasing of pm.max_children parameter for all domains can affect the server performance significantly. It is better to filter only affected domains in /var/log/plesk-phpXX-fpm/error.log file
    grep "server reached max_children setting" /var/log/plesk-phpXX-fpm/error.log
    and adjust max_children just for them.

  • Avatar
    Sharul Hafiz

    @Nikolay What is the limit of pm.max_children? let say if I have 10GB free ram.

  • Avatar
    Konstantin Annikov


    The setting is purely depends on amount of traffic for the website. Try to double the default value (from 5 to 10) and monitor the site for several days. 

    If the same error appears again, analyze the time period between reaching MaxChildren. In case the time like several minutes, double the value again (from 10 to 20), in case the error appears once a day, just add one more child to the configured value (20 to 21). 

    Typically, 20 is more than enough for medium-loaded websites. 

  • Avatar
    Marco Marsala

    This line

    # grep "server reached max_children setting" /var/log/php-fpm/error.log | awk '{print $5}' | sort -n | uniq -c

     is wrong, as it should be

    # grep "server reached max_children setting" /var/log/plesk-phpXX-fpm/error.log | awk '{print $5}' | sort -n | uniq -c
  • Avatar
    Marco Marsala

    May you insert 

    pm.max_children = 40

    in Additional PHP directives field of PHP Settings page for domain?

  • Avatar
    Konstantin Annikov (Edited )

    Hello Marco, 

    Both files (/var/log/php-fpm/error.log and /var/log/plesk-phpXX-fpm/error.log) exist on the filesystem. The first is used to store errors from system php-fpm, and the second is used when we are speaking about php-fpm which is provided bu Plesk. 

    Meanwhile, I have edited the article in this way: 

    # grep "server reached max_children setting" /var/log/*php*-fpm/error.log | awk '{print $5}' | sort -n | uniq -c

    As for the second question, Additional PHP directives field is used to insert configuration directives in /var/www/vhosts/system/ file (configuration file for php itself), however pm.max_children directive should be added to the configuration file of php-fpm pool (/var/www/vhosts/system/ 
    So, this is two different files. And now Plesk could manage only php settings, but not php fpm pool settings. 
    If you would like Plesk to manage php fpm pool settings, vote for this feature on Plesk Uservoice portal. 

  • Avatar
    Lars Doe


    You provided the same path for both php.ini files and said these were two different files. 

  • Avatar
    Ivan Postnikov

    Hello @Lars,

    Thank you for noticing. Indeed, additional directives are stored in/var/www/vhosts/system/ and PHP-FPM settings are stored in /opt/plesk/php/X.X/etc/php-fpm.d/

    As it is stated in the article, now it is possible to change PHP-FPM settings in Pleks GUI.

  • Avatar
    Bob B

    I'd like to create a weekly scheduled task (cron job) to check for "server reached max_children setting" in the plesk-php*-fpm error.log, on CentOS 7.  It looks like that log is rotated weekly. 

    Could someone make a suggestion for a good way to schedule a weekly task, which will e-mail the server administrator, weekly, with a list of domains that have reached "max_children"?  I suppose I could create something in "/etc/cron.weekly", but how do I make sure the script runs before the weekly log rotation?

  • Avatar
    Taras Ermoshin

    Hello @Bob B!

    You are right, the log files from the directories /var/log/plesk-phpXX-fpm/ are rotated weekly - in the logrotate configuration files /etc/logrotate.d/plesk-phpXX, options daily, weekly, monthly, or yearly are not specified, and in the main configuration file /etc/logrotate.conf, the option weekly is set.

    For the weekly task you would like to create, you can write a corresponding script and put it into the option prerotate/endscript in the logrotate configuration files /etc/logrotate.d/plesk-phpXX. For more details on logrotate configuration options, see the link Please note that the script should be made on your own.

Please sign in to leave a comment.

Have more questions? Submit a request