Docs / Troubleshooting / How to Fix PHP-FPM Server Reached pm.max_children Setting

How to Fix PHP-FPM Server Reached pm.max_children Setting

By Admin · Mar 1, 2026 · Updated Apr 23, 2026 · 26 views · 2 min read

Fixing PHP-FPM pm.max_children Errors

When your Breeze logs show "server reached pm.max_children setting," PHP-FPM has exhausted its worker pool and cannot handle additional requests. This causes slow page loads, timeouts, and 502/504 gateway errors.

Understanding the Error

PHP-FPM spawns a fixed number of worker processes. When all workers are busy processing requests and a new request arrives, it gets queued or rejected. Check your current status:

sudo tail -f /var/log/php-fpm/www-error.log
# Look for: "server reached pm.max_children setting"

Check Current Usage

Enable the PHP-FPM status page and review process counts:

sudo SCRIPT_FILENAME=/status SCRIPT_NAME=/status REQUEST_METHOD=GET cgi-fcgi -bind -connect /run/php-fpm/www.sock

Calculate Optimal max_children

Determine how much memory each PHP worker uses on average:

ps --no-headers -o rss -C php-fpm | awk '{ total += $1; count++ } END { print total/count/1024 " MB average per worker" }'

Formula: max_children = (Available RAM - System Overhead) / Average Worker Memory

Update PHP-FPM Configuration

Edit /etc/php-fpm.d/www.conf (or your pool file):

pm = dynamic
pm.max_children = 30
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 10
pm.max_requests = 500

Apply Changes

sudo systemctl restart php-fpm

Setting pm.max_requests prevents memory leaks by recycling workers after a set number of requests. Monitor your Breeze memory usage after adjusting to ensure you have not over-allocated.

Was this article helpful?