回答
錯誤只空白頁它幾乎肯定在php.ini中禁用display_errors
的情況。
這是產品服務器上的一件好事,並且使開發系統基本無法使用。
對於你可能要添加這些行之一你php.ini文件開發系統:
error_reporting = E_ALL & ~E_NOTICE
或
error_reporting = E_ALL
爲了補充說明,你可能會發現Web服務器日誌中的錯誤(對於Apache,這通常是/ var/log/httpd/error_log) – Amber 2009-08-07 19:45:55
確保使用error_reporting在php.ini
已開啓error_reporting = E_ALL | E_STRICT
請確保在您的php.ini文件中顯示了display_errors並將error_reporting設置爲E_ALL。
與啓動腳本:
<?php
ini_set ('display_errors', 1);
error_reporting (E_ALL | E_STRICT);
?>
你可能配置error_reporting
(see also),並啓用錯誤(見display_errors
或ini_set)的顯示 - 至少在開發機器上
在php.ini文件,你會使用
error_reporting = E_ALL | E_STRICT
display_errors = On
html_errors = On
或者,在你的PHP代碼:
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'On');
您可能還需要在開發機器上安裝Xdebug,獲得不錯的stacktraces wehn錯誤/異常發生
當然,你生產的機器上,你可能不希望顯示錯誤;這樣,將有根據環境;-)
創建例如test.php的文件與此內容進行配置:
<?php
phpinfo();
?>
執行它在瀏覽器和搜索在php.ini文件位於。 比在php.ini中打開錯誤報告和顯示錯誤。
雖然其他答案能夠回答您的問題,但我只想指出,最好提供自己的錯誤檢查例程(或代碼),以便您的腳本將向用戶顯示令人愉快的錯誤消息。 像
[email protected]_query($some_query);
if(!$result){
if($debugging==TRUE){
echo($some_query.'<br>'.mysql_error());//shows error in debugging mode
}
else{
log_error()// error logging function
die('there was a problem with your request the problem has been logged and we are working on it');//or something like that
}
}
//no error
more code
的
- 1. JTable的犯規顯示
- 2. 重寫規則的htaccess的犯規工作和錯誤500顯示
- 3. VS2010項目建設犯規,但犯規顯示
- 4. 的TextView的setText犯規顯示
- 5. 的ViewPage MVC的犯規顯示
- 6. strftime的犯規顯示一年正確
- 7. 改造犯規顯示嵌套的ArrayList
- 8. jQuery的谷歌地圖犯規顯示
- 9. IFRAME犯規顯示正確的框架
- 10. simplexml_load_string的foreach犯規顯示任何
- 11. Django的主頁犯規顯示
- 12. SQLite的加入犯規顯示什麼
- 13. Safari的犯規顯示nvd3圖表
- 14. XtraReport犯規顯示子報告
- 15. 更改CSS犯規纔會顯示
- 16. 角ngCordova日期選擇犯規顯示
- 17. AsyncDisplayKey - stacklayout犯規在屏幕上顯示
- 18. 我GDB拆卸犯規正常顯示
- 19. AvalonDock LayoutAnchorable犯規顯示控制
- 20. 子視圖選項卡犯規顯示
- 21. 春@ExceptionHandler犯規處理錯誤
- 22. QSharedMemory ::拉手犯規存在錯誤
- 23. 平等犯規用PHP
- 24. Flash錯誤:警告:過濾器不會呈現。犯規顯示某些字體
- 25. 顯示PHP錯誤
- 26. PHP顯示錯誤
- 27. 顯示錯誤 - PHP
- 28. PHP錯誤顯示
- 29. 重寫規則顯示錯誤的URL
- 30. 我想在錯誤的div顯示錯誤消息,如果正則表達式犯規比賽
可能重複[如何獲得在PHP有用的錯誤信息?(http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in- php) – Jocelyn 2012-11-16 00:32:08