2015-04-14 23 views
1

我有WAMP php 5.4.12,我想報告錯誤。當`error_reporting`設置爲`E_ALL`時,無法顯示php錯誤

php.ini包含以下內容:

; Common Values: 
; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) 
; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) 
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) 
; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) 
; Default Value: E_ALL & ~E_NOTICE 
; Development Value: E_ALL | E_STRICT 
; Production Value: E_ALL & ~E_DEPRECATED 
; http://php.net/error-reporting 
error_reporting = E_ALL 

,但沒有錯誤顯示。

error_reporting應該使用什麼值,以及如何檢索報告的錯誤?

回答

0

您可以檢查您嘗試運行的php腳本(它將覆蓋php ini標誌)中的任何錯誤報告標誌以及是否還在.htaccess文件中。這些是覆蓋php .ini標誌的兩個選項。

+0

感謝您的意見 – maxelcat

3

我猜display_errors在你的php.ini中被關閉。嘗試下面的代碼(在你正在使用的php文件中)。

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

用於設置標誌從php.ini中,找到display_errors是和值更改爲On。如果這不起作用,請發佈完整的php.ini。

+0

我在error_reporting = E_ALL後添加了你的代碼,現在我得到了:顯示錯誤頁面的錯誤:應用程序實例化錯誤:無法連接到MySQL。 – maxelcat

+1

我找到了。 (這個感覺有點傻) - 錯誤報告在後臺關閉...對不起! – maxelcat

相關問題