Solved.
With great thanks to cPanelMichael from this forum, and Timothy G from cPanel support, I'd like to summarize in one spot a relatively complete process (along with the "gotchas" to be aware of) when making a global/default change to PHP-FPM configuration values.
This works perfectly for us, but if anyone sees an error, please let me know and I'll edit this post for the benefit of others visiting the forum.
1. Individual user configuration files, which take precedence over new global values, are held at...
Code:
/var/cpanel/userdata/*/*.php-fpm.yaml
If these individual user files contain a conflicting setting, they will take precedence over a new global value. So if you want to set pm_max_children to a new global value for example, you would first need to make sure no conflicting pm_max_children values exist in the individual user files. A completely vanilla user configuration file looks like...
2. To define new default values which you want to apply, the entries need to be added to...
Code:
/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
While some directives are accepted without a strict YAML "---" document separator, some critically are not. To avoid confusion and frustration, always begin the system_pool_defaults.yaml with the YAML "---" document separator.
For simple PHP-FPM user pool values, the working syntax is along the lines of...
Code:
pm_max_children: 15
pm_max_requests: 30
For PHP php_admin type values, one of a few working syntaxes is...
Code:
php_admin_flag_allow_url_fopen: { name: 'php_admin_flag[allow_url_fopen]', value: Off }
php_admin_value_error_reporting: { name: 'php_admin_value[error_reporting]', value: E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT }
I prefer the above syntax since it agrees with the official cPanel document at
Configurations Values of PHP-FPM - Version 68 Documentation - cPanel Documentation
The php_admin_flag directive is used for boolean settings, and php_admin_value is used for non-boolean settings.
A complete and valid system_pool_defaults.yaml looks like...
Code:
---
pm_max_children: 15
php_admin_flag_allow_url_fopen: { name: 'php_admin_flag[allow_url_fopen]', value: Off }
php_admin_value_error_reporting: { name: 'php_admin_value[error_reporting]', value: E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT }
3. To apply the values entered in step 2 above, run...
Code:
/scripts/php_fpm_config --rebuild
4. To check that the changes have been applied as you expected, look in the file for a domain respective to its PHP version. For a domain of dummy.com running PHP 7.2 for example, look in...
Code:
/opt/cpanel/ea-php72/root/etc/php-fpm.d/dummy.com.conf
For the system_pool_defaults.yaml values used in the example above, the following lines should be present among the other default directives...
Code:
php_admin_flag[allow_url_fopen] = Off
pphp_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
pm.max_children = 15
I hope some other admins find this useful.
Best regards,
LBJ