Why is my website exhausting PHP's Max Children?
---
description: 'Hashtags: #php #fpm #limits'
---
# Why is my website hitting PHP Max Children limit?
### What is max_children and what does it do?
The **max_children** variable in PHP is a setting that controls the maximum number of PHP requests that can run simultaneously on a website. This limit helps protect the server from slow or error-prone scripts that could consume all available memory.
### What happens when the max_children limit is reached?
1. If the website scripts cannot respond to existing requests before new requests arrive, **PHP-FPM** will generate additional PHP processes to handle them in parallel.
2. **PHP-FPM** will continue to generate more additional PHP processes as requests accumulate on the website.
3. However, once the number of processes reaches the limit set by **max_children**, **PHP-FPM** will stop generating additional PHP processes.
4. At that point, additional requests will be placed in a queue and will only be responded to once an existing request is completed.
<div data-gb-custom-block data-tag="hint" data-style='info'>
**Important:** The **max_children** variable does not determine the number of simultaneous visitors your website can have. The number of simultaneous visitors can be much higher than the **max_children** setting.
</div>
It's important to note that the **max_children** variable does not limit the number of simultaneous visitors your website can have, but rather the maximum number of PHP requests running simultaneously.
Since website visitors typically make requests every few seconds and PHP execution time is only a small part of the total time needed to complete a request, the number of visitors your website can handle is much higher than the limit set by **max_children**.
### Example of operation:
Each visitor to your website clicks a link or submits a form every 10 seconds. Each requested PHP script takes 10 milliseconds to execute.
Based on that example, the first 10 requests will be executed immediately, and the next 5 that come in will be queued until the previous requests are completed. Each resolved request will make room for a request in the queue, and so on until all are finished.
The number of visitors to your website will likely exceed the **max_children** limit, but due to the time intervals between visitor actions and the relatively short PHP script execution time, the website will still be able to efficiently respond to all requests.
<div align="left">
<figure><img src="../../../.gitbook/assets/MaxChildren.png" alt=""><figcaption></figcaption></figure>
</div>
Therefore, with a **max_children** of 10, your website can support up to 10,000 visitors simultaneously.
You can see how important it is for PHP scripts to execute quickly. If each PHP request took 2 seconds to execute instead of 10 milliseconds, the website could only support 100 visitors simultaneously.
Hitting the **max_children** limit indicates that some part of the website is running a PHP process too slowly.
<div data-gb-custom-block data-tag="hint" data-style='info'>
When using platforms like Wordpress, Joomla, Moodle, etc., the processing time of requests to your website will depend on the theme and plugins used.
</div>
PreviousWhat to do if my connection to the server was blocked by the firewall?NextWhy can't IonCube activate on shared hosting servers?
Last updated