4

Contrary to most people's problem I cannot get PHP to stop showing errors, I have in my php.ini display_errors set to off but it still shows them, I have also tried .htaccess, and inline ini_set and error_reporting variables but the errors still show.

What can I do to prevent this overide?

Mac OS X Lion Server 10.7.1 MAMP Compiled using instructions from DIY Mac Server (diymacserver.com)

UPDATE:

This is where my php.ini file is stored...

This is where my php.ini is

This is the value of my display_errors setting at run time

This is the value of my display_errors

And this is the copy and paste value written in /etc/php.ini

display_errors = Off

5 Answers5

2

make sure your editing the right php.ini file as there are two ini files, one for apache and one for CLI.

klj613
  • 131
1

I came across similar behaviour recently and found out that the php.ini layout is quite confusing: listing of the default values etc. is at the top of the file while description of the setting and the setting itself are way further down. (see php 7 ignores ini files, but claims to load).

  1. It could well be that a later setting overrides yours. Browse or search the ini file for all occurences of "display_errors": grep -n display_errors/etc/php.ini
  2. What is the value of "Loaded Configuration File "?
Titus
  • 271
0

The display_errors directive can be altered at runtime with the ini_set function. Make sure that none of the code is turning error display back on.

Also, when you update php.ini settings, make sure to restart Apache.

0

Do you have an auto_append_file= setting that is causing php to include code on every page that uses ini_set() to turn the display back on?

DerfK
  • 19,826
0

It is worth bearing in mind that even if you don't display or log errors, they still have a big impact on throughput and performance.

The 3 most obvious causes are:

1) you are changing the wrong php.ini file (which you've already addressed).

2) the php.ini setting is over-ridden somewhere else - if this is mod_php then that could be in the httpd.conf files or .htaccess

3) you didn't restart the PHP process (httpd when we're talking about mod_php) after making the changes

symcbean
  • 23,767
  • 2
  • 38
  • 58