phperror-reportingini-set

PHP does not return errors at all


I am running PHP and nginx and I use a production version of php.ini. So the variable display_error is set to Off and there is a good reason I want it this way. But for certain files I need to enable error reporting. I used ini_set to turn on error reporting. But a simple code snippet like:

<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);

echo "hi"errorrrrr
?>

does not trace the error. It simply returns a HTTP 500 Internal Server Error message. What should I do to enable error reporting?


Solution

  • The answer I was looking for is in the comments of this answer: PHP does not return errors at all

    The reason it doesn't work in the first place is that, since there are syntax errors in your file, PHP does not parse it at all. Thus, it doesn't execute the log_errors calls and has to rely on the settings in php.ini.

    ā€“ cmptrgeekken Mar 16 '10 at 18:16