How to recover from a fatal error quot;Allowed memory size exhaustedquot;(如何从致命错误“已用完允许的内存大小中恢复)
问题描述
您是否知道从 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.
这篇关于如何从致命错误“已用完允许的内存大小"中恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何从致命错误“已用完允许的内存大小"中恢复


基础教程推荐
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何替换eregi() 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01