Can't turn off error notifications in PHP 5.3.2
I recently switched to PHP 5.3.2 and realized that I cannot turn off error notifications on my site. I went to php.ini and on these lines:
; Common Values:
; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.)
; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.)
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
; http://php.net/error-reporting
error_reporting = E_ALL & ~E_NOTICE
... I tried to configure everything (and restart apache every time) but I cannot get rid of the notifications.
The only way to get rid of notification errors is to set:
display_errors = Off
This is of course not something I can do, as I need to see errors in order to fix them, and I would like to see errors on the webpage that I am coding, rather than log them somewhere.
Can anyone please help? Is this a bug in PHP 5.3.2 or is it something I am doing wrong?
Thanks a lot for your time!
P.S. Also, does anyone know how I can get PHP 5.3.2 to support the .php3 extension?
a source to share
Ok, I figured out what was going wrong. I set error_reporting in my code which was rewriting the php.ini error_reporting error.
Now the reason the same stuff worked until I upgraded to PHP 5.3.2 was not - in my code I set the error_reporting command:
error_reporting (6143);
I had to install it like:
error_reporting (E_ALL ^ E_NOTICE);
I'm guessing the value 6143 is different in PHP 5.3.2 versus 4.1 (or whatever my previous version was).
As for the php3 extension, it must be installed in the /etc/httpd/conf.d/php.conf file:
AddHandler php5- script.php.php3
AddType text / html.php
Thanks sourcez for your suggestions!
a source to share
I too faced the same error today on my website where I am using the TCPDF library to generate PDFs. It worked fine, but suddenly I started getting the following error today
Severity: 8192
Message: Imagick::clone method is deprecated .....
The hosting provider may have updated PHP or Imagick. PHP - 5.4 and Imagick - 3.x
So, to get rid of this in my code, I set error_reporting as
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
And it will show errors, but not outdated notifications. In the meantime, I can change my code to support the newer version of Imagick.
a source to share