PHP管理内存不足错误

时间:2016-10-01 08:30:53

标签: php

在我的代码中,我得到了这个错误:

php fatal error out of memory (allocated ) (tried to allocate bytes)

我尝试将特定代码插入TRY CATCH块,但程序已经停止执行。

如何管理此错误以确保程序继续执行?

即注意错误并继续运行

2 个答案:

答案 0 :(得分:0)

你无法捕捉到这类错误。

您所能做的就是注册一个关闭功能来记录该错误。

https://insomanic.me.uk/php-trick-catching-fatal-errors-e-error-with-a-custom-error-handler-cea2262697a2#.oqtjicwor

答案 1 :(得分:0)

php.ini增加内存限制

set_time_limit(0);
ini_set('memory_limit', 'XXM');