Recently my PHP scripts became unresponsive, and the browser just kept on trying to load the page. This was odd since the script works on my local machine, but not the development server. There was no apparent reason for this issue.
I then discovered that the PHP-FPM log showed the following message: “WARNING: [pool www] server reached pm.max_children setting (5), consider raising it”. This log is located under /var/log/php7.2-fpm.log. Note that you may be running a different version PHP.
This issue seems to occur when there are many parallel executions of PHP scripts. Simply restarting Apache did not resolve this issue for me.
To fix it – change the pm.max_children setting in the www.conf configuration under /etc/php/7.2/fpm/pool.d :
; The number of child processes to be created when pm is set to 'static' and the ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. ; This value sets the limit on the number of simultaneous requests that will be ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP ; CGI. The below defaults are based on a server without much resources. Don't ; forget to tweak pm.* to fit your needs. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' ; Note: This value is mandatory. pm.max_children = 5
My default was set to 5, but this number can be increased. Don’t set this number too high either, since this can cause other issues. Read this for more info.
Remember to restart PHP-FPM after the change using:
sudo service php7.2-fpm restart
You should not see the following message in the PHP-FPM log: “ready to handle connections” If your site is still not starting, then check your other Apache logs.