Page 1 of 1

PHP.ini error_reporting values for additional PHP parser not working

Posted: Sun 4. Feb 2024, 13:03
by hakeryk
OS: Debian 12
Virtualization: KVM
KH version: 23.2.1 (Build 3125)

Problem
I am not able to disable error_reporting to E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING in the additional PHP 7.4 parser.

Expected result
Do not show Warnings and Deprecated information at production. Actually don't show anything at all, only log.

Actual result
Still showing Warnings and Deprecated information at production

Steps to reproduce
I tried to change it in:
> GENERAL > User Administration > Editing user > PHP > Additional PHP settings:
By typing

Code: Select all

error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING
and saving, later restarting with

Code: Select all

service keyhelp-php74-fpm restart
I tried to change manually it in .ini file that was shown in

Code: Select all

phpinfo();
output which is /opt/keyhelp/php/7.4/etc/php.ini
Saving, restarting php7.4, apache. No action at all.

Additional information
I did not tried to change /opt/keyhelp/php/7.4/etc/php-fpm.d/username_php74.conf because there is information that:
; DO NOT CHANGE ANYTHING IN THIS FILE!
; CHANGES WILL BE LOST ON NEXT UPDATE.
The weird thing is that in this file there is a line:

Code: Select all

php_value[error_reporting] = 24565
but it still no luck.

Re: PHP.ini error_reporting values for additional PHP parser not working

Posted: Sun 4. Feb 2024, 13:15
by Tobi
Probably

Code: Select all


display_errors = on

is missing.


https://www.tutorialspoint.com/how-to-d ... n-php-file

Re: PHP.ini error_reporting values for additional PHP parser not working

Posted: Sun 4. Feb 2024, 13:19
by hakeryk
But my goal is to DISABLE showing errors, warning and deprecated messages, not enabling them.

P.S Changing display_errors = Off in any .ini file is not working as well.
Adding this command to additional PHP settings is also not working.

This is odd.
--------------------

EDIT: Solved but... in a weird way.

in /opt/keyhelp/php/7.4/etc/php-fpm.d/username_php74.conf I had this content:

Code: Select all

php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f username@domain.pl
php_admin_value[upload_tmp_dir] = /home/users/username/tmp/
php_admin_value[memory_limit] = 1024M
php_admin_value[max_execution_time] = 1400
php_admin_value[post_max_size] = 128M
php_admin_value[upload_max_filesize] = 128M
php_admin_value[open_basedir] = /home/users/username/www:/home/users/username/files:/home/users/username/tmp
php_admin_value[disable_functions] = dl, disk_free_space, diskfreespace, stream_socket_sendto, proc_get_status, proc_nice, proc_open, proc_terminate, proc_close, popen, curl_multi_exec, pcntl_exec, pcntl_fork, pcntl_setpriority, symlink, link, posix_kill, posix_mkfifo, posix_setsid, posix_setuid, posix_setpgid, posix_getpwuid, show_source, highlight_file, syslog, error_log, openlog, define_syslog_variables, apache_child_terminate, apache_setenv, apache_note, exec, system, shell_exec, passthru
php_admin_value[soap.wsdl_cache_dir] = /home/users/username/tmp/
php_value[session.save_path] = /home/users/username/tmp/
php_value[max_input_var] = 20000
php_value[max_input_time] = 180
php_value[error_reporting] = 24565
php_value[allow_url_fopen] = 
php_value[display_errors] = Off
but when I add at the end (not that is php_admin_value not php_value)

Code: Select all

php_admin_value[display_errors] = Off

errors are not displayed anymore but this command is also not visible in GENERAL > User Administration > Editing user > PHP > Additional PHP settings.


All I am saying is that changing anything in .ini files pointed out in phpinfo() is doing nothing at all. It is better to change it in /opt/keyhelp/php/7.4/etc/php-fpm.d/username_php74.conf in do not touch it from Keyhelp panel.

Re: PHP.ini error_reporting values for additional PHP parser not working

Posted: Mon 5. Feb 2024, 09:34
by Alexander
It is working fine on my side.

The issue i think you are encountering is the following:

Your application sets the display_errors somewhere in your applications code (eg. "ini_set()" ). This setting will override, what you have inserted into "GENERAL > User Administration > Editing user > PHP > Additional PHP settings".

As a reminder:
Everything which uses "php_admin_value" can not be overridden by the user.
Everything which uses "php_value" can be overridden by the user.

Everything you put into "PHP > Additional PHP settings" (besides some special cases) will use "php_value".
I may have to implement an addition textarea for "php_admin_value" at some point.

Re: PHP.ini error_reporting values for additional PHP parser not working

Posted: Mon 5. Feb 2024, 14:51
by hakeryk
I will give it a try to search for some custom ini_set in the app code because I didn't consider that.

Thanks for this info anyway:
Everything which uses "php_admin_value" can not be overridden by the user.
Everything which uses "php_value" can be overridden by the user.
If I will "fix" this I will update/edit this post.

Re: PHP.ini error_reporting values for additional PHP parser not working  [SOLVED]

Posted: Wed 28. Feb 2024, 10:45
by Alexander
With KeyHelp 24.1 the former "additional settings" field for PHP settings is replaced by 2 setting fields, one is for immutable settings (using "php_admin_value") and the other one is for mutable settings (using "php_value").
This should help for scenarios like described here.