PHP内存溢出:Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes)
- 解决办法(仅供参考)
- 1、修改 php.ini 文件
- 2、在代码中设置
- 3、修改.htaccess 文档(前提是该目录支持.htaccess)
- 4、把数据尽可能的打散
解决办法(仅供参考)
1、修改 php.ini 文件
- 将 memory_limit 由 8M 改成 16M(或更大),重启 apache / nginx 服务
2、在代码中设置
- 在 PHP 代码中 加入
ini_set("memory_limit", "100M");
- 注意:为了系统的其它资源的正常使用 请您不要将 memory_limit 设置太大
ini_set("memory_limit", -1); //-1不限制内存
3、修改.htaccess 文档(前提是该目录支持.htaccess)
- 在文档中新增一句:
php_value memory_limit 16M
(或更大)
4、把数据尽可能的打散
- 如果是求和数据:可以
分页
追加求和数据,把一个query_all
查询中的所有数据,分散成query_limit()
方法,避免查询所有内存直接溢出 - 如果方法行数太多,把方法
拆分成小方法
,把一个方法中耗的大量内存分摊到各个小方法中去
PHP内存溢出:Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes)相关推荐
- composer windows 下面内存溢出 Allowed memory size of 1610612736 bytes exhausted
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocat e 4096 bytes) in ph ...
- Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 359404 bytes) in
为什么80%的码农都做不了架构师?>>> Fatal error: Allowed memory size of 8388608 bytes exhausted (tried ...
- Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to allocate 64 bytes) in D
Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to allocate 64 bytes) in D 从数据库 ...
- 执行php程序的时候,报错Allowed memory size of 134217728 bytes exhausted (tried to allocate 83 bytes)...
执行php程序时,会报下面的错误 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 83 ...
- Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 85 bytes)
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 85 bytes) PHP5中,对于m ...
- PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8192 bytes)
内存已耗尽,这关系到PHP的memory_limit的设置问题 1.修改配置文件 ~]# vi /etc/php7/php.ini memory_limit = 256M 2.重启 superviso ...
- php,Allowed memory size of 8388608 bytes exhausted (tried to allocate 1298358 bytes)
修改apache上传文件大小限制 PHP上传文件大小限制解决方法: 第一: 在php.ini里面查看如下行: upload_max_filesize = 8M post_max_size = ...
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes)
命名空间下的 redis 坑
- 一次排查PHP内存溢出的心路:PHP Fatal Error Allowed memory size
一个项目的服务器报错 Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes ...
- Symfony\Component\Debug\Exception\FatalErrorException: Allowed memory size of 2147483648 bytes
最近生产环境上出现了内存溢出的问题,由于项目中操作表格的地方超级多,所以一时半会没有办法定位到是哪出的代码引起的内存溢出. [2023-02-02 12:16:22] lumen.ERROR: Sym ...
最新文章
- C语言按两个字节读写二进制文件,C语言 读写二进制文件(示例代码)
- Python技术基础知识点:OS模块的应用
- java warning 编译_关于性能:Java编译器警告会影响编译时间吗?
- python中减法运算函数_详解 Python 的二元算术运算,为什么说减法只是语法糖?...
- mysql json 创建索引_MySQL · 最佳实践 · 如何索引JSON字段
- 华科05年计算机考研复试机试
- python loop until_python3-asyncio 学习笔记 3 -- run_until_complete
- 实现Apriori算法(python)
- usage java,dnsjava usage
- Julia: array =tuple, 与 ...
- 【Rainmeter】简简单单的 一言 小皮肤
- 五百强各大行业简介+面试流程+tips
- 迷宫游戏|自动寻径|随机生成迷宫地图|UI|闯关|地图反转
- 2019.07.23--运用三W法则初步学习SpringCloud基础知识
- 做一个最简单的上位机
- python数据库管理系统ess_【简说Python WEB】数据库
- 申报不能忘,2022年湖北省各地专精特新小巨人企业奖励补贴政策汇编(附申报条件)
- QWebEngineView如何忽略SSL证书错误
- 响应式布局之微软商城部分开发
- Windows游戏开发学习一 —— WinMain函数
热门文章
- c++ 开方_20款丨空调控制系统的三种打开方式
- 在写csdn博客时,如何实现用超链接进行页面内跳转?
- java hdfs ha_hadoop2.x hdfs完全分布式 HA 搭建
- java hql left join_求教hql的left join结合条件的写法
- php如何在sql语句中使用,php – 如何在SQL查询中使用数组
- picker封装 uniapp_uni-app之picker
- 明日之后哪个服务器人最多_明日之后,末日寻宝活动上线,远星城宝箱位置攻略...
- centos6安装mysql并远程连接_Linux中Mysql不支持远程连接解决办法
- 审查元素找不到创建的元素_面试被问:Selenium元素定位不到问题,如何回答?...
- 用户常见的问题以及特殊技术问题