PHP fails silently when function not defined?
I am migrating from PHP4 to PHP5
I have this in my .htaccess:
php_flag display开发者_运维问答_errors on
php_value error_reporting 2039
Which used to show all errors.
I am still getting some errors but I used to get an error when I called a function that was not defined, but now it stops where it is at and send the client everything up to the error and nothing after. With no error message.
Here is what phpinfo is telling me:
Directive Local Value Master Value
display_errors On Off
error_reporting 2039 6143
I would like to be able to see my error messages for trouble shooting purposes.
Can someone tell me what I need to do? Thanks!!
If everything fails, just put this code at the beginning of your (/of each) script:
error_reporting(E_ALL);
ini_set('display_errors', 1);
This should show you all messages:
ini_set('display_errors', true);
error_reporting(E_ALL);
I'd guess that you PHP 5 version is >= PHP 5.2.0 and that the original error reporting level was E_ALL & ~E_NOTICE
(or E_ALL ^ E_NOTICE
, both have the same result).
Prior to PHP 5.2.0 E_ALL
had a value of 2047
, so your error level was 2039
due to not including the E_NOTICE
level (of 8
). As of PHP 5.2.0 E_ALL
changed to 6143
(and as of PHP 5.3.0 to 30719
) which means E_ALL & ~E_NOTICE
is no longer 2039
, but rather 6135
(or 30711
in PHP 5.3).
As for not displaying the errors (calling an undefined function should be a fatal error!), see the other answers.
精彩评论