LBJ

Well-Known Member
Nov 1, 2003
117
24
168
cPanel Access Level
DataCenter Provider
I've now set up a test VPS to check this further.

On the test VPS, we're seeing the same result as we do on all our dedicated servers. Adding an entry such as pm_max_children: 20 to the yaml, and then rebuilding, does not have the same desired result on any of our v68.0.21 boxes as you're demonstrating above.

The test box is obviously a completely different architecture to our live servers, and its only similarity is that it runs the same cPanel version and basic software configuration.

I'm going to raise a support ticket with cPanel to clarify this.

Best regards,

LBJ
 

LBJ

Well-Known Member
Nov 1, 2003
117
24
168
cPanel Access Level
DataCenter Provider
Your Support Request ID is: 9158379

G'day Team,

We've had a discussion with cPanelMichael via the cPanel forum regarding an issue on all our servers where the process of configuring PHP-FPM values is not working as designed on any of our boxes.

For background information, please follow the thread onwards from...

php-fpm fails once a day

When we add an entry exactly as cPanelMichael specifies like...

pm_max_children: 20

...to the file...

/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

...and then run...

/scripts/php_fpm_config --rebuild

...we do not see the configuration move through as cPanelMicahel advises that it should to the WHM interface and...

/opt/cpanel/ea-php71/root/etc/php-fpm.d/dummy.com.conf


Steps to reproduce:

nano /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

Add the entry...

pm_max_children: 20

Save the change.

Then run...

/scripts/php_fpm_config --rebuild

Then check for the change in...

nano /opt/cpanel/ea-php71/root/etc/php-fpm.d/dummy.com.conf

Also check in...

WHM > Software > MultiPHP Manager > Pool options

Best regards,

LBJ
 

LBJ

Well-Known Member
Nov 1, 2003
117
24
168
cPanel Access Level
DataCenter Provider
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...

Code:
---
_is_present: 1


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
 
Last edited:
  • Like
Reactions: cPanelMichael

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hi @LBJ,

Following up to thank you for sharing the outcome. The guide you posted should help other users with the same question.

@Nirjonadda, there's no update to report on the status of internal case CPANEL-13411 at this time. I'll update this thread as soon as new information is available.

Thank you.
 

dzamanakos

Well-Known Member
Feb 15, 2014
79
6
58
Larisa / Greece
cPanel Access Level
Root Administrator
Hi, i've followed the guide but still warning logs are logged, leading to over quota accounts.
One problem was that i have some crashes when using "php_admin_value_error_reporting", so after reading a user's file, for example /opt/cpanel/ea-php70/root/etc/php-fpm.d/domain.gr.conf, i've noticed that error_reporting was added as php_value_error_reporting, so i changed to it accordingly.

is there something else i should change?

my files are :

#more /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
pm_max_children : 32
pm_max_requests : 500

php_value_error_reporting: { name: 'php_value[error_reporting]', value: E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT }


#more /opt/cpanel/ea-php70/root/etc/php-fpm.d/domain.gr.conf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; cPanel FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; NOTICE This file is generated, please use our WHM User Interface
; to set these value.

[some_user]
catch_workers_output = yes
chdir = /home/some_user
group = some_user
listen = /opt/cpanel/ea-php70/root/usr/var/run/php-fpm/a3aeeefa43e686e506b95227da7d3ec84b11e212.sock
listen.group = nobody
listen.mode = 0660
listen.owner = some_user
php_admin_flag[allow_url_fopen] = on
php_admin_flag[log_errors] = on
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_value[doc_root] = "/home/some_user/public_html"
php_admin_value[error_log] = /home/some_user/logs/some_user.php.error.log
php_admin_value[short_open_tag] = on
php_value[error_reporting] = E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
ping.path = /ping
pm = ondemand
pm.max_children = 32
pm.max_requests = 500
pm.max_spare_servers = 5
pm.min_spare_servers = 1
pm.process_idle_timeout = 10
pm.start_servers = 0
pm.status_path = /status
security.limit_extensions = .phtml .php .php3 .php4 .php5 .php6 .php7
user = some_user

best regards,
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hi, i've followed the guide but still warning logs are logged, leading to over quota accounts.
Hello,

Can you verify the specific behavior you are seeking? For instance, do you want to stop the logging of all errors?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
New @cPanelMichael Internal case CPANEL-13411 still are not fixed?
Hello @Nirjonadda,

It looks like the issue in that case was solved via the changes from another case in cPanel & WHM verison 66:

Fixed case CPANEL-13521: Update Apache php-fpm service manager module to be less aggressive on checks.

Please open a new thread if you continue to experience issues with this service.

Thank you.