Allowed memory size of xxxxxxxxxx bytes exhausted (tried to allocate 8192 bytes)-PHP内存溢出问题

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值