XAMPP不显示php错误

时间:2011-02-28 12:10:58

标签: php ubuntu xampp

我在ubuntu上安装了xampp。 PHP配置为显示所有可能的错误,警告,通知等,但当我在PHP代码中出错时,不会显示错误。

当我将该文件复制到其他计算机(debian with native apache,mysql和php set)并在浏览器中打开它时显示

Fatal error: Call to a member function fetch() on a non-object in... 

正如所料,为什么xampp与相同的php.ini只显示一个空页?

3 个答案:

答案 0 :(得分:1)

可能有一些服务器配置错误
在下面写下你的php页面的第一行

ini_set('error_reporting', E_ALL);
ini_set( 'display_errors', 1 );

注意:使用Xdebug

答案 1 :(得分:1)

另一种解决方案是

.htaccess文件

中添加此行
php_value display_errors on

答案 2 :(得分:0)

找到你的php.ini文件。您可以在终端中输入php --ini来找到该位置。

然后查找display_errors并将其设置为1.并且error_reporting到E_ALL。

这将全局设置值。

如果您只需要查看特定脚本或应用程序的错误:

error_reporting( E_ALL );
ini_set( 'display_errors', 1 );

http://php.net/manual/en/function.error-reporting.php

http://php.net/manual/en/errorfunc.configuration.php

相关问题