PHP-FPM is a popular PHP FastCGI implementation that can drastically improve website loading time and resource utilization on your server. There are, however, some settings to be aware of when using PHP-FPM, which may need to be adjusted depending on the needs of your website or application and the traffic received.
Specifically, these settings are Max Requests, Max Children, and Process Idle Timeout. If these values are not set high enough, your website may experience 503 or 504 errors. Here we detail the steps to adjust these VPS or Dedicated server settings.
Related Articles
Toggle PHP-FPM for Domain in WHM
Log into Root WHM Using AMP
Modify PHP-FPM Settings
IMPORTANT: This solution will require root access. If this needs to be obtained, follow the guide on requesting root access.
- Log into Root WHM
- Navigate to Software -> MultiPHP Manager
- To adjust limits for all domains
- On the System Settings tab, click the Manage Settings button
- On the System Settings tab, click the Manage Settings button
- To adjust limits for a single domain
- Navigate to the User Domain Settings tab
- Click the PHP-FPM Settings button beside the applicable domain
- Navigate to the User Domain Settings tab
- Adjust the values as needed
TIP: See the section at the end of this article for recommended settings.- Max Requests controls how many requests are served by a process (Max Children) before killing and spawning a new process
- Max Children is the number of PHP-FPM processes to spawn to process PHP code for web server requests
-
Process Idle Timeout is the number of seconds after which an idle process is set to be killed so it releases CPU time and RAM
- Click the Update button
- Navigate to Restart Services>PHP-FPM service for Apache
- Click the Yes button to restart the PHP-FPM service
Recommended Settings
IMPORTANT: These recommendations are general guidelines and are not always the most appropriate settings for all server environments. PHP-FPM settings should be adjusted according to your server resources and your website(s) or application(s) needs. Please see cPanel's documentation for more details on PHP-FPM Performance Tuning.
CAUTION: It's safer to increase these values a little bit at a time. Raising any of these settings too high can cause services on the server to crash due to running out of memory.
- Safe limits for VPS systems
Max Requests: 80
Max Children: 17
Process Idle Timeout: 10 - Safe limits for Dedicated servers
Max Request: 250
Max Children: 25
Process Idle Timeout: 10
Comments
0 comments
Article is closed for comments.