What could cause php.ini to ignore error

So when I set this directive in php.ini

error_reporting = E_ALL & ~E_DEPRECATED

I still get these errors even after apache reload or reboot.

Thu Sep 13 10:51:10 2012] [error] [client 173.59.22.4] PHP Deprecated: Assigning the return value of new by reference is deprecated in

etc etc etc.

Any ideas? I am not sure why php.ini will not listen to this directive to not list deprecated.

PHP 5.3.3 (cli) (built: Jul 3 2012 16:53:21) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies


There are several places from which the value of this setting can be changed, including the quite commonly seen ini_set and error_reporting functions. Someone is changing it from one of them.


error_reporting could've been called somewhere in your script.

you can use this to reset it before the error occurs:

error_reporting(E_ALL & ~E_DEPRECATED);

This took me ages to debug. Code generated by an old version of phprunner which was crashing because of "Deprecated function mysql_connect. But whatever I did with error_reporting

error_reporting(E_ALL & ~E_DEPRECATED); // was being ignored

It was because the code was using its own error handling function "error handler"

set_error_handler("my_error_handler"); // override error_reporting()

All I had to do was add the following line to function my_error_handler()

if ($errno==8192) return 0;   // ignore Deprecated

I wasted ages fiddling with my php.ini but it had nothing to do with it!

链接地址: http://www.djcxy.com/p/65080.html

上一篇: Nginx或PHP FPM忽略内存

下一篇: 什么可能导致php.ini忽略错误