Posted by

Website Down? How I Fixed It by Restarting PHP-FPM in Ubuntu

Website Down? Here’s What Happened

Recently, my PHP-based application went down—completely unresponsive. No errors, no crashes—just a blank, stalled site. Sound familiar?

Diagnosing the Problem

I suspected something with PHP-FPM, so I checked its status on my Ubuntu server:

sudo systemctl status php8.1-fpm

The result?

Status: "Processes active: 5, idle: 0, Requests: 13432, slow: 0, Traffic: 0.00req/sec"

This told me:

  • All PHP workers were busy (Processes active: 5)
  • No idle workers available (Idle: 0)
  • Traffic had stopped despite thousands of past requests

That explained the freeze: PHP-FPM was overloaded.

✅ The Quick Fix: Restart PHP-FPM

To bring the site back online instantly, I ran:

sudo systemctl restart php8.1-fpm

After that, the server started handling traffic again and the site was back.

Why It Happened: PHP-FPM Limits

By default, PHP-FPM allows only a limited number of concurrent worker processes. If your site gets too many simultaneous requests, those processes can all get occupied — and when they’re full, new requests just wait (or time out).

The Real Fix: Increase Worker Limits

To avoid this in the future, I edited PHP-FPM’s config:

sudo nano /etc/php/8.1/fpm/pool.d/www.conf

And changed:

pm = dynamic
pm.max_children = 10         ; was 5
pm.start_servers = 3         ; was 2
pm.min_spare_servers = 2     ; was 1
pm.max_spare_servers = 5     ; was 3

Then reloaded the service:

sudo systemctl restart php8.1-fpm

Now, my server can handle more concurrent users without freezing up.

Bonus Tip: Monitor in Real-Time

Keep an eye on PHP-FPM activity with:

sudo journalctl -fu php8.1-fpm

And monitor Nginx/Apache logs:

sudo tail -f /var/log/nginx/error.log

Conclusion

If your PHP site suddenly freezes up, don’t panic. Check your PHP-FPM status — you might just need a quick restart. But for long-term stability, increasing the number of PHP worker processes based on your traffic is the way to go.