StéphanS
Regular Pleskian
TITLE:
mod_php showing outputting warnings in HTML while display_errors Off
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:Plesk Onyx 17.5, x64, Ubuntu 14.04 Trusty / CloudLinux 6.8
PROBLEM DESCRIPTION:Hi,
after upgrading both servers from Plesk 12.5 to Plesk 17.5
We were contacted by our customers that their sites started showing PHP Warnings in the web browser.
When looking into this, it seems that Apache configs have been changed to now include
"php_admin_value error_reporting xxxxx"
:
<IfModule sapi_apache2.c>
php_admin_flag engine on
# General settings
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value error_reporting 22519
# Performance settings
# Additional directives
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
# General settings
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value error_reporting 22519
# Performance settings
# Additional directives
</IfModule>
<IfModule mod_php7.c>
php_admin_flag engine on
# General settings
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value error_reporting 22519
# Performance settings
# Additional directives
</IfModule>
STEPS TO REPRODUCE:after upgrading both servers from Plesk 12.5 to Plesk 17.5
We were contacted by our customers that their sites started showing PHP Warnings in the web browser.
When looking into this, it seems that Apache configs have been changed to now include
"php_admin_value error_reporting xxxxx"
:
<IfModule sapi_apache2.c>
php_admin_flag engine on
# General settings
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value error_reporting 22519
# Performance settings
# Additional directives
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
# General settings
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value error_reporting 22519
# Performance settings
# Additional directives
</IfModule>
<IfModule mod_php7.c>
php_admin_flag engine on
# General settings
php_admin_flag safe_mode off
php_admin_value open_basedir none
php_admin_value error_reporting 22519
# Performance settings
# Additional directives
</IfModule>
Create a basic PHP site
and place following file into it:
error.php
<?php
trigger_error("test", E_USER_WARNING);
?>
Set PHP settings to Apache mod_php and set display_errors to Off (or 0).
This warning should not be displayed via HTML.
And yet it is.
ACTUAL RESULT:and place following file into it:
error.php
<?php
trigger_error("test", E_USER_WARNING);
?>
Set PHP settings to Apache mod_php and set display_errors to Off (or 0).
This warning should not be displayed via HTML.
And yet it is.
PHP Errors and Warnings are displayed through HTML.
EXPECTED RESULT:PHP Errors and Warnings should only be logged to error_log when display_errors is set to Off (or 0).
ANY ADDITIONAL INFORMATION:Fixes:
sed -i.bak '/php_admin_value error_reporting/d' /var/www/vhosts/system/domain.tld/conf/httpd.conf && service httpd restart || service apache2 restart #remove these php_admin_value settings
Possible other fix (stops Errors and Warnings from displaying in HTML as well):
php_admin_value error_reporting "E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED"
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:sed -i.bak '/php_admin_value error_reporting/d' /var/www/vhosts/system/domain.tld/conf/httpd.conf && service httpd restart || service apache2 restart #remove these php_admin_value settings
Possible other fix (stops Errors and Warnings from displaying in HTML as well):
php_admin_value error_reporting "E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED"
Confirm bug