PHP error guide

PHP-FPM server reached pm.max_children: meaning and fix

Error summary

Profile slow requests and calculate a safe max_children from measured worker RSS. All configured FPM children are occupied and new work must wait.

What it means

Profile slow requests and calculate a safe max_children from measured worker RSS. All configured FPM children are occupied and new work must wait.

What the error means

This message means that all configured FPM children are occupied and new work must wait. The exact signature distinguishes php-fpm server reached pm.max_children from a generic application failure.

Why PHP produces it

The engine or service reports “PHP-FPM server reached pm.max_children” because its required precondition was not met. Profile slow requests and calculate a safe max_children from measured worker RSS.

PHP version notes

The php-fpm server reached pm.max_children wording here is based on Current PHP-FPM, Apache 2.4, or nginx; punctuation and exception class names can differ on older branches or vendor builds.

Most common causes

  • The immediate input or configuration reaches the specific condition: all configured FPM children are occupied and new work must wait
  • The code path assumes the prerequisite for php-fpm server reached pm.max_children has already been satisfied.
  • For php-fpm server reached pm.max_children, development and production differ in version, extension, permissions, paths, or service configuration.
  • An earlier operation returned an unchecked value that is consumed by the line reporting php-fpm server reached pm.max_children.

Minimal examples

BAD — reproduces the problem

ini
pm.max_children = 5

FIXED — safer pattern

ini
; after measuring worker RSS and RAM
pm.max_children = 20

Step-by-step diagnosis

  1. Copy the complete “WARNING: [pool www] server reached pm.max_children setting (5), consider raising it” text and retain the first application stack frame.
  2. Reproduce php-fpm server reached pm.max_children in the same SAPI and environment listed for this page.
  3. Before changing php-fpm server reached pm.max_children, inspect the preceding value or directive and verify its type, path, version, and permissions.
  4. Apply the narrow correction—profile slow requests and calculate a safe max_children from measured worker RSS—then repeat the original request once.

Fixes

Correct the failing prerequisite

Profile slow requests and calculate a safe max_children from measured worker RSS

ini
; after measuring worker RSS and RAM
pm.max_children = 20

Fail explicitly at the boundary

Validate the condition before the operation that emits php-fpm server reached pm.max_children, and log a safe diagnostic without credentials or full production paths.

Common mistakes when fixing it

  • Suppressing php-fpm server reached pm.max_children instead of correcting its upstream condition.
  • Testing php-fpm server reached pm.max_children only with the CLI binary when the failing request runs under FPM or Apache.
  • Changing a global setting for php-fpm server reached pm.max_children before confirming the site-specific effective configuration.

How to prevent it

  • Add a focused test that exercises the boundary responsible for php-fpm server reached pm.max_children.
  • Keep runtime versions, extensions, configuration, and deploy artifacts affecting php-fpm server reached pm.max_children reproducible.
  • Validate external data and service return values before they can trigger php-fpm server reached pm.max_children.

Web server / environment notes

fpm, linux. The failure occurs where all configured FPM children are occupied and new work must wait

Tags: fpm,linux

Categories