由数组未初始化引起PHP脚本出现内存不足 PHP Fatal error: Allowed memory size of
来源:互联网 发布:mac 清理磁盘空间 编辑:程序博客网 时间:2024/06/03 19:39
项目中遇到需要统计周粒度数据,随着时间越来越长,请求的数据会越来越多,超过nginx fastcgi_read_timeout 10
的限制,所以出现504 Gateway Time out,我把数据放到一个中间数据表中,当前端需要请求数据的时候从 中间数据表中获取数据,但是,发现Http状态码变成了500,看了一下日志报错出现
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 336219 bytes)
PHP脚本内存不足,使用
echo memory_get_usage();
看了一下内存使用,超出了php.ini中memory_limit 128M
的限制,所以开始报错,找了好久,最后看了一下中间表的数据,不是很正常,多出来很多重复的数据,原因是
我代码中没有声明数组 $arr = array();
后面代码中使用$arr [] = array();
一直向数组中添加数据,导致多了很多重复的数据,数据量瞬间增加了很多,这样就造成出现PHP脚本出现内存不足的原因了
所以如果遇到这个问题,很可能是我们程序写的有问题,和同事一起分析,最后找到了原因,想撞墙的感觉!
阅读全文
0 0
- 由数组未初始化引起PHP脚本出现内存不足 PHP Fatal error: Allowed memory size of
- PHP: Fatal Error: Allowed Memory Size of 134217728 Bytes Exhausted
- PHP Fatal Error: Allowed memory size of 262144 bytes exhausted
- PHP Fatal error: Allowed memory size of 134 bytes exhausted
- PHP脚本占用内存太多,Fatal Error: Allowed memory size of xxxxxx bytes exhausted
- php fatal error-Allowed memory size
- php 报错 Fatal error: Allowed memory size of 134217728 bytes exhausted
- php.ini的memory_limit设置以及Fatal error: Allowed memory size of 134217728 bytes exhausted
- PHP提示Fatal error: Allowed memory size of 8388608 bytes exhausted的解决办法
- php 报错 Fatal error: Allowed memory size of 134217728 bytes exhausted
- PHP Fatal error: Allowed memory size of 134217728 bytes exhausted……解决方法
- Php Fatal error: Allowed memory size of 33554432 bytes exhausted 的解决办法
- Php Fatal error: Allowed memory size of xxx bytes exhausted 的解决办法
- Php Fatal error: Allowed memory size of 33554432 bytes exhausted 的解决办法
- magento PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate xxxxx)
- php项目编写过程中Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 3214636 byt
- Fatal error: Allowed php错误提示memory size of 8388608 bytes exhausted (tried to allocate 58368 bytes) i
- PHP: Allowed memory size of 的解决
- 数据库 char和varchar的总结
- 爬虫学习笔记--爬B站评论
- error: src refspec master does not match any
- Unity实现ui渐变效果
- hdu 2084 数塔(基础dp)
- 由数组未初始化引起PHP脚本出现内存不足 PHP Fatal error: Allowed memory size of
- AC 2017:Alloyteam Web前端大会
- iPhone X的缺口和CSS
- 再聊移动端页面的适配
- 渐进式动画解决方案
- 今年的IMWebConf,将会是一场大咖云集的前端盛宴
- CSS的状态
- 写CSS的姿势
- 2017 Amsterdam CSS Day