How to have PHP display errors? (I've added ini_set and error_reporting, but just gives 500 on errors)

后端 未结 7 1513
花落未央
花落未央 2020-12-08 19:39

So, I don\'t really have any errors in my current web page, but I want to be able to see an error when they pop up, instead of the HTTP 500 error page. I googled around a bi

7条回答
  •  借酒劲吻你
    2020-12-08 19:59

    What you have is a parse error. Those are thrown before any code is executed. A PHP file needs to be parsed in its entirety before any code in it can be executed. If there's a parse error in the file where you're setting your error levels, they won't have taken effect by the time the error is thrown.

    Either break your files up into smaller parts, like setting the error levels in one file and then includeing another file which contains the actual code (and errors), or set the error levels outside PHP using php.ini or .htaccess directives.

提交回复
热议问题