問題描述
在調試安裝到新開發環境中的 codeigniter 應用程序后,當我看到白屏沒有更多可用內容時,我開始感到害怕.我已經能夠解決導致此問題的每一個錯誤,但它認真對待了太長時間.
After debugging a codeigniter app that were installed into a new development environment, I have started to freak out when seeing white screens with nothing more available. I have been able to solve each and every one of the errors that have caused this, but it have taken seriously way too long time.
PHP error_reporting(E_ALL)
&display_errors", 1
也設置好了.我什至安裝了 Xdebug 以希望獲得更多輸出,但沒有.我的日志設置也有效,但沒有寫入日志.
PHP error_reporting(E_ALL)
& display_errors", 1
is set as well. I even installed Xdebug in hope of getting more output, but no. My logging settings are also working, but nothing is written to the log.
有沒有辦法打印出一些信息而不是完整的白屏?它肯定會縮短我花在解決導致此問題的最終錯誤上的時間?
Is there a way to get something informative printed out instead of a complete white screen? It would certainly shorten my time spent on solving the eventual errors that causes this?
非常感謝!
參考:為什么 Code Igniter 給我一個白頁?
推薦答案
我發現,自從我提出問題以來,似乎沒有什么可以確保總是用 PHP 輸出錯誤,這似乎在這里拋出白屏在那里.無論 PHP 的 ini 設置如何.
I've found out, since the time of my question, that nothing seems to ensure that errors are always outputted with PHP, which seems to throw white screens here and there. Regardless of PHP's ini-settings.
我發現最好的解決方法是使用以下行來確保將錯誤記錄放入應用程序易于訪問和監控的文件中:
I've found out that the best workaround however is to use the following line to ensure that error logging is put into a file easily accessed and monitoredby the application:
ini_set('error_log', MYPATH .'logs/errorlog.log');
據我測試,當出現白屏時 - 它也會記錄到此錯誤日志中.似乎是了解出現問題時會發生什么的最簡單方法.
As far as I've tested it, when white screens appear - it also gets logged into this errorlog. Seems to be the easiest way to know what happens when things go wrong.
這篇關于白屏死機!的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!