Apache on WHM/cPanel randomly stops working – intermittently – possible PHP-FPM issue

Symtoms

Randomly, perhaps once or twice a month, Apache completely stops serving sites. No obvious errors, except web sites aren’t loading anymore. From HTTP monitoring some key sites we can deduce it’s PHP 8.3 websites.

The first check is normally this:

service httpd status

What’s odd, Apache is running but yet not site are served. The next step we take is this:

service httpd restart

Boom! Everything start working.

Since this problem happens very infrequently it’s really hard to track, but here are some methodologies we’ve tried to eliminate the problem:

  • Audit PHP FPM in WHM make sure all is consistent. Often sites are or aren’t on FPM and maintaining consistency is key is running scalable environments.
  • Next there are two logs file indicating possible problems:
    • /var/log/apache2/error_log
      • look for The timeout specified has expired
      • When FPM stops working, you’ll have a flurry of these in Apache’s log
    • /opt/cpanel/ea-php83/root/var/log/php-fpm/error.log
      • Check for general errors. You might see server reached max_children setting (5)
      • Do you want to change this? I would recommend NO before a thorough investigation! You have to consider load on the server and why some websites are using disproportional resources.
  • The place to change max_child is MultiPHP Manager’s PHP-FPM default settings:

Other things we’ve tried in the isolation process without and breakthroughs:

  • dmesg hoping to find something like OOM. Couldn’t, and server has 20 GB RAM.
  • journalctl -u ea-php83-php-fpm --since "00:00" --until "23:59"
    • Interesting command but didn’t find anything of use

References

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *