SOLVED PHP-FPM pm dynamic / static / ondemand option

unity200

Member
Nov 16, 2006
21
3
153
I had to create this thread since the forum didnt let me post in a one year old thread which deals with the exact same issue. So, here goes:

I want to change the pm setting and set it to static. However i am not able to determine the proper way to do it.

Hello,

The information in the previous post should help. Let us know if you have additional questions.

Thank you.
Above post refers to the below page

PHP-FPM Code and FileSystem Layout for EasyApache 4 - Version 68 Documentation - cPanel Documentation

And a non-applicable guide from a forum post in which someone upgraded their easyapache 3 to easyapache 4 and fpm.

...............

Do i have to put my dynamic/static choice in /opt/cpanel/ea-phpXX/root/etc/php-fpm.conf for each PHP version per that doc page?

In those files it says that these files are auto generated - which means they would be overwritten?

In the doc it talks about below yaml files

  • /var/cpanel/ApachePHPFPM/system.yaml
  • /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
However they dont exist in my system? Do i create them and put my settings in? Which one? Do i use the syntax which php-fpm.conf uses, if not, which syntax do i use? yaml syntax?
 

unity200

Member
Nov 16, 2006
21
3
153
I saved the values in

/var/cpanel/ApachePHPFPM/system.yaml

pm: static
pm.max_children: 400

and used

/scripts/php_fpm_config --rebuild

and it worked. Thanks.
 
  • Like
Reactions: Infopro

unity200

Member
Nov 16, 2006
21
3
153
Doing the exact same operation on another server, now im getting


ERROR: [/opt/cpanel/ea-php72/root/etc/php-fpm.conf:47] unknown entry 'pm'

It seems now somehow pm entry is not recognized despite it was recognized before.

Can anyone shed some light on this?
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
Twitter
Doing the exact same operation on another server, now im getting


ERROR: [/opt/cpanel/ea-php72/root/etc/php-fpm.conf:47] unknown entry 'pm'

It seems now somehow pm entry is not recognized despite it was recognized before.

Can anyone shed some light on this?
Hello @unity200,

Can you share the step-by-step instructions of the changes you made and the specific entries you added or modified? Did you follow the guide linked on the thread below?

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

Thank you.
 

unity200

Member
Nov 16, 2006
21
3
153
Yes, i followed that guide and it doesnt work.

When i removed those values from /var/cpanel/ApachePHPFPM/system.yaml

and instead put them in

/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

it seems to have worked.

But of course, i cant be sure. I am seeing a higher number of php-fpm processes in ps -aux | grep php* , so i think it may have worked.

If someone can confirm that i would appreciate it.
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
Twitter
I saved the values in

/var/cpanel/ApachePHPFPM/system.yaml

pm: static
pm.max_children: 400
When i removed those values from /var/cpanel/ApachePHPFPM/system.yaml

and instead put them in

/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

it seems to have worked.
Hello @unity200,

To modify the value for a PHP-FPM configuration directive, it's important to first browse to the following document and search for the name of the directive you want to modify:

Configuration Values of PHP-FPM - Version 80 Documentation - cPanel Documentation

As seen on the document linked above, "pm" and "pm.max_children" are found under the Pool name directives section. Directives listed under the Pool name directives section are known as Pool directives. Thus, you'd customize the directive in the file path listed under the following section of the thread linked in my last response:

Pool Directives
Defaults: /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
Individual Domains: /var/cpanel/userdata/$username/$domain.tld.php-fpm.yaml
In this case, since you're making a change to the default value, you'd add the custom value to /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml.

Let me know if this helps.

Thank you.
 

unity200

Member
Nov 16, 2006
21
3
153
Per your post above:

- I made changes to the default value. This didnt change the amount of processes one particular site user can spawn. Despite it seems to increase the total amount of spawned processes by php-fpm.

- When i changed the individual values for children for that site account in php-fpm config for that account in MultiPHP manager in WHM, that allowed more php processes for the user.

So it seems changing default values after a user is created has no effect. Individual values from MultiPHP php-fpm configuration must be changed per domain if a user already exists.

I think we can consider this solved. Thanks.
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
Twitter
So it seems changing default values after a user is created has no effect. Individual values from MultiPHP php-fpm configuration must be changed per domain if a user already exists.
Hello @unity200,

Ensure you execute the following commands after making the change to /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml:

Code:
/usr/local/cpanel/scripts/php_fpm_config --rebuild
/scripts/restartsrv_httpd
Thank you.