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

后端 未结 7 1526
花落未央
花落未央 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 20:00

    You need to set the error_reporting value in a .htaccess file. Since there is a parse error, it never runs the error_reporting() function in your PHP code.

    Try this in a .htaccess file (assuming you can use one):

    php_flag display_errors 1
    php_value error_reporting 30719
    

    I think 30719 corresponds to E_ALL but I may be wrong.

    Edit Update: http://php.net/manual/en/errorfunc.constants.php

    int error_reporting ([ int $level ] )
    ---
    32767   E_ALL (integer)     
    All errors and warnings, as supported, except of   level E_STRICT prior to PHP 5.4.0.   32767 in PHP 5.4.x, 30719 in PHP 5.3.x, 6143 in PHP   5.2.x, 2047 previously
    

提交回复
热议问题