問題描述
您是否知道從 PHP 致命錯誤中恢復的任何解決方案:允許的內存大小...耗盡"
Do you know any solution to recover from the PHP fatal error : "Allowed memory size ... exhausted"
我有一個關閉函數,當出現致命錯誤時會調用該函數.此函數從中創建一個 ErrorException,并記錄它.
I have a shutdown function that is called when a fatal error appear. This function create an ErrorException from it, and logs it.
問題是:當沒有更多可用內存時,它無法記錄錯誤(我使用 Zend Framework 通過 FirePHP 登錄 Firebug).
The problem is : when there is no more memory available, it can't log the error (I log in Firebug, via FirePHP, with Zend Framework).
所以我所說的如何從中恢復"是指如何執行基本的錯誤日志,并讓 Zend Framework 發送標頭,以便記錄錯誤(在我的 Firebug 中)case) 和其他錯誤一樣嗎?
So what i mean by "how to recover from it", is how to perform basic error log, and let Zend Framework send the Headers, so that the error is logged (in Firebug in my case) as any other error ?
謝謝
推薦答案
此錯誤是一個致命錯誤 - 這意味著您無法從中恢復.如果 PHP 已達到其內存限制,它將無法分配更多內存來創建您的異常以及繼續執行所需的任何其他內存.
This error is a fatal error - that means you cannot recover from it. If PHP has hit it's memory limit, it won't be able to allocate any more memory to create your exception and any other memory it needs to carry on its execution.
還有另一種類型的錯誤——可捕獲的致命錯誤",顧名思義,可以在 try/catch 中捕獲,但不幸的是內存大小分配不是其中之一.
There is another type of error - "catchable fatal error" which as the name suggests, can be caught in a try/catch, but unfortunately the memory size allocation is not one of them.
這篇關于如何從致命錯誤“已用完允許的內存大小"中恢復的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!