SOLVED How-To Modify PHP-FPM Configuration Directives in EasyApache 4

celiac101

Well-Known Member
Dec 19, 2012
85
1
8
cPanel Access Level
Website Owner
[Moderation Notice: This thread was forked from PHP-FPM Restart Necessary for Site Speed]

I am having an issue with my solution to #1. It seemed to work, but then I noticed I got a formatting error:
php-fpm.yaml” file and did not apply any custom values.For more information about the correct formatting of custom values, read our Custom Templates

I use PHP 7.2 and PHP-FPM Ondemand, have formatted it several different ways in my php-fpm.yaml file, but even if it restarts without the error, I get a 503 site error:
1)
emergency_restart_threshold = 5
emergency_restart_interval = 1m
process_control_timeout = 10s

2)
pm_emergency_restart_threshold = 5
pm_emergency_restart_interval = 1m
pm_process_control_timeout = 10s

3)
pm.emergency_restart_threshold = 5
pm.emergency_restart_interval = 1m
pm.process_control_timeout = 10s

4)
pm_emergency_restart_threshold: 5
pm_emergency_restart_interval: 1m
pm_process_control_timeout: 10s

Any idea on how to format this for PHP 7.2?
 
Last edited by a moderator:

celiac101

Well-Known Member
Dec 19, 2012
85
1
8
cPanel Access Level
Website Owner
I seem to be stuck with how to edit the those settings. If I manually put them into the file (/opt/cpanel/ea-php72/root/etc/php-fpm.conf), it gets erased when I rebuild them (/scripts/php_fpm_config --rebuild –domain=domain.com), and they are lost:

emergency_restart_interval = 60
emergency_restart_threshold = 5
process_control_timeout = 10

But the settings do seem to be working there. I have tried many ways to add these to my .yaml file so that this will not happen, but each way I have tried results in an unresponsive server--503 errors.
/var/cpanel/userdata/site/domain.com.php-fpm.yaml

In the config file it says to edit the settings in the WHM interface, but when I am there I see no way to do this:

upload_2019-4-7_12-17-58.png

Any help with this would be appreciated.
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @celiac101,

Thanks for sharing the additional information.

The PHP-FPM Global directives are configured separately from the PHP-FPM Pool directives.

To modify the value for a PHP-FPM configuration directive, it's important to first browse to the Configuration Values of PHP-FPM document and search for the name of the directive you want to modify. Directives listed under the Global directives section of this document are known as Global directives. Directives listed under the Pool name directives section of this document are known as Pool directives.

Pool Directives
Defaults: /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
Individual Domains: /var/cpanel/userdata/$username/$domain.tld.php-fpm.yaml

Global Directives
Defaults: /var/cpanel/ApachePHPFPM/system.yaml
Individual Domains: N/A

For example, the following PHP-FPM configuration directives are listed under the Global directives section of the Configuration Values of PHP-FPM document:

emergency_restart_threshold
emergency_restart_interval

To modify the values for both of these Global directives, create the /var/cpanel/ApachePHPFPM/system.yaml file and populate it with the following lines:

Code:
---
emergency_restart_threshold: 10
emergency_restart_interval: 1m
Feel free to replace "10" and "1m" with your own values. After saving the file, run the following command to apply the changes to the PHP-FPM configuration files:

Code:
/scripts/php_fpm_config --rebuild
Note: If you see an error message in this command's output, verify no Global directives exist in the following Pool directive configuration files:

/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
/var/cpanel/userdata/$username/$domain.tld.php-fpm.yaml


Let me know if this helps.

Thank you.
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,233
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @celiac101,

I modified my previous post to correct the invalid configuration paths and to share more information about configuring PHP-FPM directives. Additionally, I moved the posts specific to this issue into a separate forums thread.

Let me know if you have any additional questions or if you encounter any issues with the updated instructions.

Thanks!