PHP错误不会出现在浏览器中

时间:2022-09-10 19:14:03

I am facing a strange problem. I have set up everything in php.ini file. But i can't get any errors showing up in the browser. I googled to set up the .ini file and did all the required things. But still i am not able to get error message displaying in the browser. My PHP ini settings,

我正面临一个奇怪的问题。我已经用php设置了所有内容。ini文件。但是我不能在浏览器中显示任何错误。我用google建立了。ini文件并做了所有需要的事情。但是我仍然不能在浏览器中显示错误消息。我的PHP ini设置,

display_errors = On
display_startup_errors = On
error_reporting = E_ALL | E_STRICT
log_errors = On
track_errors = On

I tried with the following code to see error message,

我尝试使用以下代码查看错误消息,

<?php
      require_once("sample.php");
 ?>

Actually the file sample is not available. So it must show Fatal error. But it is showing a blank page.

实际上文件示例不可用。所以它必须显示致命的错误。但它显示的是空白页。

Can you point me out to fix this? I don't know what i am missing here.

你能给我指出来解决这个问题吗?我不知道我在这里缺少什么。

3 个解决方案

#1


5  

You can also add custom error reporting to your php and test with that:

您还可以在php中添加自定义错误报告,并使用它进行测试:

<?php
    error_reporting( E_ALL );
    ini_set( "display_errors", 1 );
    require_once( "sample.php" );
?>

If you get fatals, then something is wrong with php.ini configuration ( maybe you have multiple php.ini files? ). If you still get nothing, then php can find the file ( maybe you have some redirects set up? Maybe some strange extensions? )

如果您遇到了问题,那么php就有问题了。ini配置(可能有多个php)。ini文件?)如果您仍然一无所获,那么php可以找到该文件(也许您已经设置了一些重定向?也许是一些奇怪的延伸?)

#2


2  

I found the problem. Actually, PHP is installed with XDebug extension. So the problem is in that extension. Even i was not aware of that. Because this system was used by someone previously. I uninstalled and installed again with new supported version. It works now. Thanks and sorry for the inconvenience friends.

我发现这个问题。实际上,PHP安装了XDebug扩展。问题就在这个范围内。甚至我都没有意识到这一点。因为之前有人用过这个系统。我卸载并重新安装了新的支持版本。现在工作。对给朋友带来的不便表示感谢和歉意。

#3


0  

Try finding these words in your php.ini file

试着在php中找到这些单词。ini文件

display_errors
error_reporting

display_errors error_reporting

change default value of display_errors from Off to On
change default value of error_reporting from XXXX to E_ERROR | E_PARSE

将display_errors的默认值从Off更改为On,将error_reporting的默认值从XXXX更改为E_ERROR | E_PARSE

Restart apache server.
Mind, It'll always show errors.

重新启动apache服务器。注意,它总是会显示错误。

#1


5  

You can also add custom error reporting to your php and test with that:

您还可以在php中添加自定义错误报告,并使用它进行测试:

<?php
    error_reporting( E_ALL );
    ini_set( "display_errors", 1 );
    require_once( "sample.php" );
?>

If you get fatals, then something is wrong with php.ini configuration ( maybe you have multiple php.ini files? ). If you still get nothing, then php can find the file ( maybe you have some redirects set up? Maybe some strange extensions? )

如果您遇到了问题,那么php就有问题了。ini配置(可能有多个php)。ini文件?)如果您仍然一无所获,那么php可以找到该文件(也许您已经设置了一些重定向?也许是一些奇怪的延伸?)

#2


2  

I found the problem. Actually, PHP is installed with XDebug extension. So the problem is in that extension. Even i was not aware of that. Because this system was used by someone previously. I uninstalled and installed again with new supported version. It works now. Thanks and sorry for the inconvenience friends.

我发现这个问题。实际上,PHP安装了XDebug扩展。问题就在这个范围内。甚至我都没有意识到这一点。因为之前有人用过这个系统。我卸载并重新安装了新的支持版本。现在工作。对给朋友带来的不便表示感谢和歉意。

#3


0  

Try finding these words in your php.ini file

试着在php中找到这些单词。ini文件

display_errors
error_reporting

display_errors error_reporting

change default value of display_errors from Off to On
change default value of error_reporting from XXXX to E_ERROR | E_PARSE

将display_errors的默认值从Off更改为On,将error_reporting的默认值从XXXX更改为E_ERROR | E_PARSE

Restart apache server.
Mind, It'll always show errors.

重新启动apache服务器。注意,它总是会显示错误。