PHP errors are shown when display_errors option is disabled

Created:

2017-08-08 05:50:13 UTC

Modified:

2017-08-21 15:40:25 UTC

1

Was this article helpful?


Have more questions?

Submit a request

PHP errors are shown when display_errors option is disabled

Applicable to:

  • Plesk for Linux

Symptoms

PHP is configured not to display errors: 'display_errors' parameter is set to Off at Plesk > Subscriptions > example.com > Websites & Domains > PHP Settings

Website started showing PHP Warnings after upgrading both servers from Plesk 12.5 to Plesk 17.5:

Message: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead

Apache configuration files have been changed to now include 'error_reporting' parameter:

# grep error_reporting /etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf
php_admin_value error_reporting 22519
php_admin_value error_reporting 22519
php_admin_value error_reporting 22519

The parameter 'ini_set' is defined in web files:

# grep -ir ini_set /var/www/vhosts/example.com/httpdocs | grep display_errors
/var/www/vhosts/example.com/httpdocs/index.php: @ini_set('display_errors', 1);

Cause

PHP settings defined via Plesk are overridden via website code.

Resolution

1. Login to the server over SSH

2. Find the website document root directory:

# httpd - D DUMP_VHOSTS | grep example.com.conf
port 80 namevhost example.com (/etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf:8) 
# grep -i root /etc/httpd/conf/plesk.conf.d/vhosts/example.com.conf
DocumentRoot "/var/www/vhosts/example.com/httpdocs"

2. Make a search for the parameter definitions in the web content:

# grep -iR ini_set /var/www/vhosts/example.com/httpdocs | grep display_errors | grep 1

3. Set the parameter value to '0' in the files found on previous step. For example:

ini_set('display_errors', '0');

Have more questions? Submit a request
Please sign in to leave a comment.