Websites on PHP-FPM are unavailable | How to fix

Home > Websites on PHP-FPM are unavailable | How to fix
 

Websites on PHP-FPM are unavailable or inaccessible? Find out what you can do to fix this.

At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Service.

Let’s take a look at how our Support Team recently helped out a customer when websites on PHP-FPM are unavailable.

What to do if websites on PHP-FPM are unavailable

If you have been experiencing unavailable websites on PHP-FPM, you are more likely to experience the following symptoms as well:

  • Slow-loading websites
  • Not accessible with a 50x error via a web browser, resulting in one of the following error messages:
    502 Bad Gateway
    503 Service Temporarily Unavailable
    504 Gateway Time-out
  • The PHP-FPM error logfile /var/log/plesk-phpXX-fpm/error.log will contain the following error message:
    WARNING: [pool example.com] server reached max_children setting (*), consider raising it
  • The following message in the /var/www/vhosts/system/example.com/logs/proxy_error_log file will appear if Nginx is enabled on the server:
    [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:

According to our proficient Support Team, these errors are due to PHP-FPM pm.max_children reaching the maximum limit. The obvious solution is to increase the pm.max_children limit for the domains that are displaying symptoms seen above.

How to resolve websites on PHP-FPM are unavailable error

  1. First, we will connect to the Plesk server through SSH.
  2. Then, we will identify the domains which are experiencing this error with the help of the following command:
    # 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
    <...>

    Our Support Techs would like to point out that the numbers on the left indicate how many times the website has reached the pm.max_children limit.

  3. Next, we will log into Plesk and navigate to Domains > example.com > PHP Settings > PHP-FPM Settings.
  4. After that, we have to increase the pm.max_children value and apply the changes as seen below:

    Websites on PHP-FPM are unavailable

[Looking for a solution to another query? We have your back.]

Conclusion

In short, the skilled Support Engineers at Bobcares demonstrated what to do when domains on PHP-FPM are unavailable.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED