問題描述
您是否知道從 PHP 致命錯(cuò)誤中恢復(fù)的任何解決方案:允許的內(nèi)存大小...耗盡"
Do you know any solution to recover from the PHP fatal error : "Allowed memory size ... exhausted"
我有一個(gè)關(guān)閉函數(shù),當(dāng)出現(xiàn)致命錯(cuò)誤時(shí)會(huì)調(diào)用該函數(shù).此函數(shù)從中創(chuàng)建一個(gè) ErrorException,并記錄它.
I have a shutdown function that is called when a fatal error appear. This function create an ErrorException from it, and logs it.
問題是:當(dāng)沒有更多可用內(nèi)存時(shí),它無法記錄錯(cuò)誤(我使用 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).
所以我所說的如何從中恢復(fù)"是指如何執(zhí)行基本的錯(cuò)誤日志,并讓 Zend Framework 發(fā)送標(biāo)頭,以便記錄錯(cuò)誤(在我的 Firebug 中)case) 和其他錯(cuò)誤一樣嗎?
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 ?
謝謝
推薦答案
此錯(cuò)誤是一個(gè)致命錯(cuò)誤 - 這意味著您無法從中恢復(fù).如果 PHP 已達(dá)到其內(nèi)存限制,它將無法分配更多內(nèi)存來創(chuàng)建您的異常以及繼續(xù)執(zhí)行所需的任何其他內(nèi)存.
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.
還有另一種類型的錯(cuò)誤——可捕獲的致命錯(cuò)誤",顧名思義,可以在 try/catch 中捕獲,但不幸的是內(nèi)存大小分配不是其中之一.
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.
這篇關(guān)于如何從致命錯(cuò)誤“已用完允許的內(nèi)存大小"中恢復(fù)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!