Allowed memory size of xxxxxxxxxx bytes exhausted (tried to allocate 8192 bytes)-PHP内存溢出问题
php程序在执行几万条的数据查询,插入,更新时,报错Allowed memory size of 2147483648 bytes exhausted (tried to allocate 8192 bytes),
错误原因:
php内存溢出:程序运行所需的内存,超出了配置(php.ini)限制。
解决方式:
直接在被调用方法开头添加
ini_set(‘max_execution_time’,7200);
ini_set(‘memory_limit’,-1);
C(‘REST_TIMEOUT’,360);
public function insertTransferDetail()
{
ini_set('ma

当PHP程序处理大量数据查询、插入或更新时,可能会出现'Allowed memory size of xxxxxxxxxx bytes exhausted (tried to allocate 8192 bytes)'的错误,这是由于程序所需的内存超过了php.ini配置限制。解决方法包括使用`ini_set`函数临时调整`memory_limit`至无限或适当值,以及`max_execution_time`以增加程序最大执行时间。优化方案是减少一次性处理的数据量,避免内存溢出并提升执行效率。
最低0.47元/天 解锁文章
8544

被折叠的 条评论
为什么被折叠?



