PHP errors are not shown

倖福魔咒の 提交于 2019-12-12 01:01:26

问题


I've got an PHP file with an error in it, but I don't know where it is and there is no error reporting, but I enabled error reporting in php.ini and in the script.

Why can't I see the error?


回答1:


Make the first four lines of your page look like this:

<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

This will override your error echoing settings elsewhere so you can track down your problem. And of course, don't forget to do a phpinfo(); if you suspect there's a missing or misconfigured dependency.




回答2:


Try enabling errors in PHP:

<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

If you still don't see anything and you are using Linux and Apache try looking into /var/log/apache2/error.log you can see the live log tail -f /var/log/apache2/error.log



来源:https://stackoverflow.com/questions/11816937/php-errors-are-not-shown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!