Cannot turn off logging to php.error.log

triatlas

Active Member
Jan 27, 2017
26
2
53
Germany
cPanel Access Level
Root Administrator
I tried to turn off error logging to /logs/#domain#php.error.log with cpanel's multi php manager for a particular account but without luck. These are the new entries set in cpanel multi php manager:

display_errors = Off
error_reporting = Off
error_log = ""


/logs/php.error.log file is still created (containing a lot of strict warnings etc.) and incresing the account's size.

How can I completely stop the creation of php.error.log file for that particular account?
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston

triatlas

Active Member
Jan 27, 2017
26
2
53
Germany
cPanel Access Level
Root Administrator
Hello @cPanelLauren

the file /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml does not contain any global values.

The file /var/cpanel/userdata/#account#/#domain#.php-fpm-yaml contains:

---
_is_present: 1
pm_max_children: 5
pm_max_requests: 20
pm_process_idle_timeout: 10
php_admin_value_log_errors: { name: 'php_admin_value[log_errors]', value: off }
php_admin_value_error_log: { name: 'php_admin_value[error_log]', value: }

I added the last two lines now but errors are still logged to the php.error.log file in the user's account.

The presence of _is_present: 1 should "activate" the values set in php.ini / .user.ini of the user's account anyway, shouldn't it?

Am I missing something?
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @triatlas

the file /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml does not contain any global values.
This file should be empty or not exist at the beginning of this and this is where you would store global values. User specific values would be modified in the yaml at
Code:
/var/cpanel/userdata/$user/$domain.tld.php-fpm.yaml
Here's what I did exactly:

1. I went to /var/cpanel/

Code:
cd /var/cpanel
and created the directory ApachePHPFPM
Code:
mkdir ApachePHPFPM
as well as the file system_pool_defaults.yaml
Code:
touch system_pool_defaults.yaml
with the contents as follows:

Code:
[root@server ApachePHPFPM]# cat system_pool_defaults.yaml
---
php_admin_flag_log_errors: {name: 'php_admin_flag[log_errors]', value: off }
I added everything including the --- which are actually required in the file.

Then once that was complete I ran:

Code:
/scripts/php_fpm_config --rebuild
Which rebuilds the apache config

Then I restarted php-fpm:
Code:
/scripts/restartsrv_apache_php_fpm
and lastly restarted apache:

Code:
/scripts/restartsrv_httpd
Once all was completed the PHP error logs in the user's /home/$user/logs/ directory ceased to be populated

I fully understand that this is extremely confusing if you're not familiar with the configuration and even a bit to some that are. To correct this we are adding an GUI in a future release of cPanel (I believe it's slated for v78)
 

triatlas

Active Member
Jan 27, 2017
26
2
53
Germany
cPanel Access Level
Root Administrator
Hello @cPanelLauren

thank you for the detailed description. I managed to disable the writing to php.error.log file for all users.

How would the workflow be if I only want to disable it for just one particular user? This is what I initially intended.

Thanks.