开发者

PHP Doesn't Display Errors or Warnings

I don't know how php.ini was configured since I don't have access to it. But on top of my php code file I have

error_reporting(E_ALL); ini_开发者_如何学Pythonset('display_errors', '1');

But still, if there is an error, e.g. missing a ")", the page is blank. It is so painful to debug without error message. Why were the errors not shown?


Your error is not an execution error, as it's a Parse Error : it happens before the page even starts being executed.

So, the two intructions that you used have not been executed yet when this error is happening... and, so, they have no effect.


A solution that would help with those Parse Errors would be to just not have them ; a couple of things that could help :

  • Using an IDE that can detect wrong PHP code
    • Eclipse PDT, for instance
    • Or netbeans
  • Use php -l your-php-file.php to check if it's valid


The error's weren't shown in this particular case because the error happened before any code was executed, hence before ini_set could change the error reporting configuration.

Check out these pages for some solutions:

  • Using .htaccess
  • Local php.ini file
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜