How to find out loaded php-fpm config values
I've specified global config values on Home / Software / MultiPHP Manager.
For max_children I've specified 150.
In the php log I see different values which I think is coming from this domain's config value.
WARNING: [pool username] server reached max_children setting (5), consider raising it
So global values are not being taken?
How do we find out loaded config values?
-
Hey there! I always recommend making a PHP info page to see the current values at the exact location you're working with. Details on how to create that file can be found here:
0 -
I already have it it doesn't show any of the config values set from MultiPHP Manager.
0 -
There is a way to find out loaded values on Linux as discussed here
https://stackoverflow.com/questions/50561553/how-can-i-determine-the-current-config-of-php-fpm
The commands specified in the solution on the above post doesn't work on cPanel, not sure what command to run for cPanel.
0 -
I replied to that other thread just now as well - let me know if you need more details.
0 -
That link is for setting the values, I've already found that link.
My issue is that I want to see what config values are loaded, how to do that?
0 -
The data in the PHP info page *should* be accurate, so I don't have a good explanation for why that isn't showing what you expect. That gets generated in real-time from the local PHP environment.
Can you give me an example configuration value that you're looking for that isn't showing up in the info page so I can test this?
0 -
Following are the values from yaml file. I want to see and verify if these values are being loaded for php-fpm, how to do that?
# cat /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
---
.......
pm: ondemand
pm_max_children: 150
pm_max_requests: 20
pm_process_idle_timeout: 10
After setting above values, in the php log I see different values which I think is coming from this domain's config value. It means that max_children value of 150 is not being loaded?
WARNING: [pool username] server reached max_children setting (5), consider raising it
0 -
Thanks for the additional details. Those values are for PHP-FPM itself, and aren't going to be related to a specific website, so those won't show up in the info page.
I believe you're actually looking for the information here:
Is that what you're trying to setup for each domain?
0 -
It is showing the consumed values (resources being used by a specific domain) and not the values which are set.
Can check these values from command line via ssh?
pool: domain
process manager: ondemand
start time: 13/Dec/2024:19:48:39 +0000
start since: 150
accepted conn: 51
listen queue: 0
max listen queue: 0
listen queue len: 0
idle processes: 0
active processes: 1
total processes: 1
max active processes: 1
max children reached: 0
slow requests: 0************************
pid: 4023957
state: Running
start time: 13/Dec/2024:19:51:04 +0000
start since: 5
requests: 2
request duration: 220
request method: GET
request URI: /status.phtml?full
content length: 0
user: -
script: /home/domain/public_html/status.phtml
last request cpu: 0.00
last request memory: 00 -
Could you just pull the data directly from the local user file at /var/cpanel/php-fpm.d/username.conf? That looks like the following on my personal server:
# cat /var/cpanel/php-fpm.d/username.conf
[user_username]
listen = "/var/cpanel/php-fpm/username/sock"
listen.owner = "root"
listen.group = "username"
listen.mode = 0660
user = "username"
group = "username"
pm = ondemand
pm.max_children = 25
pm.process_idle_timeout = 15
slowlog = "/home/username/logs/.php-fpm.slow.log"
php_admin_value[error_log] = "/home/username/logs/.php.error.log"
php_admin_flag[log_errors] = on
php_admin_value[sys_temp_dir] = "/home/username/tmp"
php_admin_value[upload_tmp_dir] = "/home/username/tmp"
php_admin_value[max_input_vars] = 10000
php_value[memory_limit] = "512M"
php_value[session.save_handler] = files
php_value[session.save_path] = "/home/username/tmp"
php_value[date.timezone] = "America/Detroit"
env[TMPDIR] = "/home/username/tmp"
catch_workers_output = yesIf you have any customizations present outside of the defaults, they will be present there as well.
0 -
There is nothing in that directory, no user accounts found there.
# ls -l /var/cpanel/php-fpm.d/
total 4
-rw-r--r-- 1 root root 895 Dec 19 2023 cpanelphpmyadmin.conf
I think the config file you meant is somewhere else.
That config file will not prove anything, I can see those values from WHM for each domain and also the global values.
I want to see what values php-fpm is running with. I want to see run time values.
As per this thread https://stackoverflow.com/questions/50561553/how-can-i-determine-the-current-config-of-php-fpm the commands to see these run time values are:
sudo php-fpm7.0 -tt sudo php-fpm7.x -tt sudo php-fpm7.4 -tt
sudo php-fpm8.0 -tt sudo php-fpm8.1 -tt sudo php-fpm8.2 -tt
What are the equivalent commands to run in a cPanel Linux?
0 -
There are no equivalent commands.
At this point it would be best to submit a ticket since the files I am expecting to find on your system that contain the customizations do not exist, so I can't say where you will be able to pull that data from.
0 -
The config values are showing in the WHM so it must be saved in files somewhere. I've seen these files, I forgot the path.
0 -
The only other idea I have would be the API call here:
https://api.docs.cpanel.net/openapi/whm/operation/php_fpm_config_get/
Here is an example of that in action:
[root@test ~]# echo '{"domain":"account1.one"}' | whmapi1 --input=json php_fpm_config_get
---
data:
config:
-
base_flag_name: error_reporting
trinary_admin_value: 2
value: E_ALL & ~E_NOTICE
-
base_flag_name: error_log
trinary_admin_value: 1
value: "[% homedir %]/logs/account1_one.php.error.log"
-
base_flag_name: pm_max_children
trinary_admin_value: 0
value: 6
-
base_flag_name: disable_functions
trinary_admin_value: 1
value: exec,passthru,shell_exec,system
-
base_flag_name: allow_url_fopen
trinary_admin_value: 1
value: 'on'
-
base_flag_name: log_errors
trinary_admin_value: 1
value: 'on'
-
base_flag_name: pm_max_requests
trinary_admin_value: 0
value: 21
-
base_flag_name: doc_root
trinary_admin_value: 1
value: "[% documentroot %]"
-
base_flag_name: pm_process_idle_timeout
trinary_admin_value: 0
value: 11
-
base_flag_name: short_open_tag
trinary_admin_value: 1
value: 'on'
domain: account1.one
metadata:
command: php_fpm_config_get
reason: OK
result: 1
version: 1
[root@test ~]#0 -
Found the config file locations, they are in
/opt/cpanel/ea-php81/root/etc/php-fpm.d
/opt/cpanel/ea-php82/root/etc/php-fpm.d
/opt/cpanel/ea-php83/root/etc/php-fpm.dI can see domains config files there.
The values in config files:
pm.max_children = 5
This is the default value set by cPanel.
I've set this value to be 150 from global settings.
So which value is being taken by php-fpm during run? 5 or 150? How do we confirm?
If it is 5 then how do we force it to accept 150 value (set globally)?
0 -
I've also run the API, following is the value
{
"base_flag_name" : "pm_max_children",
"trinary_admin_value" : 0,
"value" : "5"
},
So it is taking 5? Why it is not taking 150 which is set globally
# cat /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml | grep child
pm_max_children: 150
How do we force all domains to accept global values?
0 -
Have you previously modified the PHP-FPM values ??for those domains?
Take a look at:
Bulk Editing of All Domain's PHP-FPM Settings – cPanelAs long as you did not already edit the values in the MultiPHP Manager > "User Domain Settings" tab. Once you begin editing those values for a specific domain, then that domain will never be affected by the default values from MultiPHP Manager > "System Settings" ever again.
0 -
I've read that thread.
As far as I can remember I didn't touch any individual's domain settings. Let's assume the worst case I did accidentally touched any individual domain. What is the solution now. Do I need to go through over 40 domains one by one to modify them? Do we have any script or setting available now that can take care of it.
0
Please sign in to leave a comment.
Comments
18 comments