2011-02-28 230 views
2

我在Ubuntu上安裝了xampp。 PHP配置爲顯示所有可能的錯誤,警告,通知等,但是當我在php代碼中出錯時,不顯示錯誤。XAMPP不顯示php錯誤

當我將該文件複製到其他計算機(Debian的與本地的Apache,MySQL和PHP集),並在瀏覽器中打開它,它顯示

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

不如預期,那麼爲什麼XAMPP具有相同的php.ini卻與此一個空的頁面?

回答

1

可能會有一些serever配置錯誤
在你的PHP網頁下方寫作爲一線

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

注:使用Xdebug

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

+0

我已啓用在php.ini中顯示錯誤: error_reporting = E_ALL | E_STRICT display_errors = On display_startup_errors = On – WombaT 2011-02-28 12:31:34

+0

您可能會因爲其他計算機上的數據庫不同而發生該錯誤。應用程序中可能沒有任何錯誤。 – HyderA 2011-02-28 17:12:10

1

另一種解決方案是

.htaccess文件

加入這行
php_value display_errors on 
+1

沒有改變任何東西 - 仍然是空白頁面上的錯誤 – WombaT 2011-02-28 14:15:18

+0

它只有在做出這一改變後才適用於我。 – 2014-09-30 20:39:00