DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk11 min

PHP Workers vs. PHP Memory Limit: The Difference, How They Interact, and How to Tune Both

PHP-FPM workers control concurrent requests; memory_limit controls PHP-managed memory for one request. Learn how they interact, how to diagnose failures, and how to tune both without causing OOM problems.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PHP-FPM workers and PHP’s memory_limit control different dimensions of capacity. A worker is a child process that handles one request at a time; pm.max_children sets how many requests can be handled concurrently. memory_limit sets the maximum PHP-managed memory that one script/request may allocate. Increasing one does not automatically increase the other: more workers improve possible concurrency but can raise total RAM use, while a higher memory limit lets an individual request attempt a larger workload without creating another worker.

What each setting actually limits

PHP-FPM workers limit simultaneous service

PHP-FPM (FastCGI Process Manager) keeps a pool of PHP child processes ready to receive requests from a web server. Each child normally serves one request at a time. When every child is busy, additional requests wait in the web server or FastCGI queue, or are rejected by an upstream timeout or capacity limit.

As an Amazon Associate I earn from qualifying purchases.

The central control is pm.max_children. In static mode it is the fixed number of child processes. In dynamic and ondemand modes it is the maximum number of children that may exist. PHP’s FPM documentation describes this as the limit on simultaneous requests served.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

memory_limit limits one script context

PHP’s core memory_limit directive is the maximum amount of memory, in bytes, that a script is allowed to allocate through PHP’s memory manager. The current PHP manual documents a default of 128M. That is a documentation default, not a universal production recommendation.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

The limit applies to an individual request/script context. A request can hit it and fail while other FPM children are idle. Conversely, a request may remain under its limit while the server runs out of aggregate RAM because many workers, extensions, the operating system, and other services are consuming memory at the same time.

PHP-FPM process-management modes

The pm setting determines how FPM creates and retires child processes. The modes change process lifetime and startup behavior, but pm.max_children remains the concurrency ceiling.

Mode How children are managed What pm.max_children means Operational trade-off
static FPM creates a fixed pool. The exact number of children. Predictable capacity and memory footprint, but idle children remain allocated.
dynamic FPM adjusts the pool using pm.max_children, pm.start_servers, pm.min_spare_servers, and pm.max_spare_servers. The maximum number of children. Balances warm capacity with the ability to remove excess idle processes.
ondemand FPM starts children when requests arrive. The maximum number of children that can be created. Can reduce idle memory use, at the cost of process startup work during bursts.

These modes do not alter the per-request PHP memory ceiling. A process created by any mode still observes the effective memory_limit for the request it executes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What “memory limit” includes—and what it does not

memory_limit is enforced against memory reserved by PHP’s memory manager. The value reported by PHP memory functions is therefore not the same as the complete resident memory of the operating-system process. Native extensions, allocator behavior, shared libraries, FPM overhead, and other allocations can make a worker’s operating-system footprint larger than the PHP-level figure.

This distinction explains why “free RAM” does not guarantee that a request can continue. A script can reach its PHP allocation ceiling before the host is out of memory. The reverse is also possible: no single request reaches memory_limit, yet the host or container is killed by the operating system after the combined process footprint exceeds its available memory.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Setting memory_limit=-1 removes PHP’s own limit. It does not remove container, operating-system, cgroup, hosting-plan, or physical-RAM limits, so it can turn a contained application error into an unrestricted memory surge.

How workers and memory multiply each other

The settings are independent controls, but their resource effects combine. Suppose a pool permits 20 concurrent children and active requests commonly use about 100 MB of PHP-managed memory each. A full burst could approach 2 GB of PHP-managed allocations (20 × 100 MB). That is a capacity-planning inference, not a guaranteed allocation: requests differ, workers have baseline overhead, extensions may allocate outside PHP’s tracked manager, and the operating system and other services also require memory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Change Immediate effect Risk to watch What it cannot fix
Raise pm.max_children Allows more requests to execute at once when traffic is available. Higher aggregate process and PHP memory use; possible host or container OOM. A request that already exceeds its memory_limit.
Lower pm.max_children Caps concurrency and limits aggregate pressure. More queueing and higher latency during bursts. A memory-hungry script that cannot fit within its per-request limit.
Raise memory_limit Allows one request to allocate more PHP-managed memory. Large requests can consume more RAM; simultaneous large requests multiply that cost. A shortage of workers or an upstream queue limit.
Lower memory_limit Fails oversized requests earlier and protects aggregate capacity. Legitimate imports, reports, or media operations may fail. Worker saturation caused by too many concurrent requests.

Do not treat the product of pm.max_children and memory_limit as an exact RAM requirement. memory_limit is a ceiling, not a promise that every request will consume that amount, and PHP-level accounting is not the entire process footprint.

Recognizing which limit you have hit

Observed symptom Most likely control First checks
“Max children reached,” growing request wait time, or requests queued while CPU and RAM are not necessarily exhausted Worker/concurrency capacity Check pm.max_children, the selected pm mode, web-server/FastCGI queue limits, and upstream timeouts.
“Allowed memory size exhausted” in a PHP error Per-request memory_limit or the request’s allocation pattern Identify the script, inspect its peak PHP memory use, and look for unusually large input, an inefficient operation, or a leak.
Container or host OOM kill, often without a PHP “allowed memory” error Aggregate process or non-PHP memory Compare process/container/host memory with PHP-level measurements; include all services and native-extension allocations.
Slow responses only during traffic spikes Usually concurrency, queueing, or CPU contention Observe active children, queue time, CPU, and memory before changing either directive.

Symptoms can overlap. A high worker count can create memory pressure that slows every request, while a low worker count can make a single slow request appear to be a general performance problem. Measure both dimensions instead of changing both settings simultaneously.

Where to configure each value

For a self-managed environment where you can apply these pool settings, Antihost VPS offers Linux VPS instances with full root access, NVMe storage, 1 to 16 vCPUs, and 2 to 64 GB RAM in the USA East, Netherlands, and Ukraine.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

FPM pool settings

Worker controls such as pm, pm.max_children, and the dynamic-mode start/spare settings belong in the FPM pool configuration. The exact file location depends on the operating system and packaging, so use the pool loaded by the running FPM service rather than assuming a distribution-specific path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
[www]
pm = dynamic
pm.max_children = 20
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 8

The numbers above are an example of syntax, not a sizing recommendation. A configuration change takes effect only after the relevant FPM service validates and reloads the pool; follow the service manager’s validation and reload procedure for your deployment.

Pool-level PHP memory policy

An FPM pool can set a hard PHP value with a directive such as:

php_admin_value[memory_limit] = 256M

The FPM manual notes that a value supplied with php_admin_value cannot be overridden by ini_set() in application code. This is useful when an administrator must enforce a ceiling regardless of what a script requests at runtime.

A normal php_value[memory_limit] setting and an application-level ini_set('memory_limit', ...) can have different precedence depending on the deployment. Verify the effective value in the same SAPI and pool that serves the failing request; a command-line PHP value is not automatically the FPM value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Verifying the effective value

Check the running FPM configuration and the request’s PHP information through your normal operational diagnostics. A small diagnostic page or application log can record ini_get('memory_limit') and memory_get_usage(true); protect or remove such a page because it exposes environment information. Also inspect FPM status, web-server logs, and host/container metrics so that PHP-level and operating-system-level observations are correlated.

How to choose a worker limit without guessing

  1. Define the available budget. Start with RAM actually available to the PHP service or container, not the host’s installed total. Reserve capacity for the operating system, web server, database, queues, caches, and monitoring.
  2. Measure representative requests. Record PHP peak usage and operating-system process/container memory for normal pages and the heaviest legitimate operations. Include background jobs or administrative endpoints if they share the pool.
  3. Estimate concurrent demand. Look at active-request counts and queue time during normal peaks. A worker is useful only when there is a request to serve; adding children beyond CPU, I/O, or upstream capacity can reduce rather than improve throughput.
  4. Apply headroom. Use measured typical and peak footprints, then leave room for bursts, allocator overhead, native extensions, and non-PHP services. Do not multiply the documented 128M default by a desired worker count and call that a safe host requirement.
  5. Choose the process mode. Use static when a predictable always-warm pool is appropriate; use dynamic when you want controlled warm capacity; use ondemand when reducing idle children matters and startup latency is acceptable.
  6. Change one variable at a time. Adjust pm.max_children or the memory ceiling, reload safely, and compare latency, queueing, PHP errors, peak memory, CPU, and host/container memory before making the next change.

A useful planning expression is:

aggregate PHP-managed memory ≈ concurrent active requests × measured PHP memory per request

It is deliberately an estimate. Add process baseline and non-PHP usage separately, and validate the result under a representative load rather than assuming every request has identical behavior.

Why increasing pm.max_children can make a server worse

When workers are saturated but memory and CPU have substantial headroom, increasing the ceiling may reduce queueing. If workers are already consuming most available memory, the same change allows more copies of expensive work to run concurrently. The result can be swapping, CPU contention, longer response times, and an OOM kill instead of higher throughput.

There is also an upstream ceiling. A web server, reverse proxy, load balancer, database connection pool, or container limit may queue or reject requests before PHP-FPM reaches its own maximum. Raising FPM children cannot bypass those limits. Check the whole request path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why increasing memory_limit can hide the real problem

An “allowed memory size exhausted” error is sometimes caused by a genuinely legitimate large operation, but it can also reveal an unbounded result set, duplicate data structures, an accidental recursion, or a leak. Raising the limit may let the operation finish once while making every concurrent copy more expensive.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Before raising it, identify the endpoint and operation, measure its peak PHP allocation, and determine whether the workload can be reduced: paginate records, stream a file, process batches, release large temporary arrays, or move a long job out of the web request. If the operation is legitimate and bounded, set the smallest pool or request policy that accommodates its measured peak, with aggregate headroom.

Configuration precedence and common traps

  • CLI is not FPM. Running php -i or a command-line script may read a different php.ini and SAPI configuration than the FPM pool serving web traffic.
  • A pool policy can override application intent. php_admin_value[memory_limit] cannot be raised with ini_set().
  • The displayed limit may not be the effective pool limit. Check from a request handled by the affected pool, not from an unrelated virtual host or command-line process.
  • Worker count is not a memory reservation. A child can use little memory for one request and much more for another; the operating system also accounts for memory outside PHP’s manager.
  • Unlimited is not free. -1 removes only PHP’s own allocation guard and can expose the host to uncontrolled growth.

Worked scenarios

Scenario: queueing with successful requests

A site has a small FPM pool and receives a burst of requests. Existing requests complete successfully, but new requests wait and logs indicate that the maximum child count has been reached. The first investigation is worker capacity and upstream queueing. Raising memory_limit would not create another child and would not shorten the queue.

Scenario: one report fails at a repeatable size

A report endpoint fails with “allowed memory size exhausted,” while other requests continue and idle workers are visible. That points to the report’s per-request allocation or effective memory_limit. Inspect the report’s data volume and peak allocation, then optimize or raise the limit only if the measured workload is legitimate and the pool has aggregate headroom.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Scenario: no PHP memory error, but the container is killed

Several requests each stay below the PHP ceiling, yet the container is terminated during a burst. The combined workers, native allocations, and other processes exceeded the container’s memory budget. Lowering concurrency, reducing per-request usage, or increasing the container budget addresses this class of failure; changing only the PHP ceiling may have no effect.

A safe change-and-verify procedure

  1. Record the current effective pm.max_children, process mode, memory_limit, request latency, error rate, queue indicators, CPU, and process/container memory.
  2. Classify the symptom as queueing, a PHP allocation failure, or aggregate OOM pressure.
  3. Change only the control associated with that symptom, using a small, reversible step.
  4. Validate the FPM pool configuration before reloading it, then reload the service using your platform’s standard procedure.
  5. Exercise normal and worst-case endpoints, watching both PHP-level usage and operating-system/container metrics.
  6. Keep the change only if throughput or workload completion improves without unacceptable latency, memory pressure, or new errors; otherwise revert and investigate the workload or upstream bottleneck.

The practical distinction in one table

Question PHP-FPM workers / pm.max_children memory_limit
Scope All child processes in an FPM pool. One PHP script/request context.
Limits Simultaneous request service capacity. PHP-managed allocation allowed to the script.
Typical failure Queueing, “max children reached,” or upstream wait. “Allowed memory size exhausted.”
Main trade-off Potential throughput versus aggregate RAM and CPU pressure. Larger individual workloads versus greater per-request and aggregate RAM risk.
Configuration area FPM pool pm.* directives. PHP core configuration, including pool-level php_admin_value.

Bottom line for tuning

Treat concurrency and per-request memory as two measurements in the same capacity model. Use worker metrics and queue time to decide whether the pool is too small; use PHP allocation data and “allowed memory” failures to decide whether a request is too large; use host or container metrics to detect aggregate pressure that neither setting alone describes. Increase one control at a time, preserve headroom, and verify the effective values in the FPM environment that serves real traffic.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.