I am having difficulties in overriding the default PHP settings within my Drupal installation. I do not want Drupal to display E_NOTICE messages. So I wanted to override the default PHP error_reporting setting from E_ALL to E_ALL & ~E_NOTICE or from 2047 to 2039 (the corresponding error reporting values).

I added the line ini_set('error_reporting', 2039); in both sites/default/settings.php and sites/default/default.settings.php, but still when I go the status report page and view the PHP info file, I see the error reporting setting of PHP is still set to 2047. What am I doing wrong here? How to override the php setting?

PS: I even tried adding the line php_value error_reporting 2039 to Drupal's .htaccess file, but there is no effect.

  • Do you get any error message about ini_set() being disabled? Did you verify it is not disabled? Notice that you should not touch the default.settings.php. Drupal doesn't use that file when running; it is just used to create the settings.php file when installing Drupal. – kiamlaluno Sep 25 '12 at 2:23
  • How about putting this log_errors = Off in your .htaccess – ninjascorner Sep 25 '12 at 6:32

You will have to add

error_reporting(E_ALL ^ E_NOTICE);

to the settings.php file. Here's more.

  • Thanks for your answer. But it is not working.. The setting remains the same. – Vivek Mar 16 '12 at 7:43
  • do you mean that the Notice's are still displayed? But it works fine on mine. D7 btw. – karth Mar 16 '12 at 8:08
  • Yes the notices are still getting displayed. BTW, can you check your phpinfo() for the error reporting values? – Vivek Mar 16 '12 at 8:32
  • error_reporting 30711 hope it helps :) – karth Mar 16 '12 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.