当前位置:首页 > 技术问答 > PHP报错”Allowed memory size of 134217728 bytes exhausted“的解决方法

PHP报错”Allowed memory size of 134217728 bytes exhausted“的解决方法

技术问答 / 星之宇 / 2021-8-27 21:22 / 浏览:2732 / 评论:0

问题描述

PHP开启错误输出后,PHP报错提示如下

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 131072 bytes) in xxxx.php on line xxx

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1099 bytes) in

197-1.png


问题分析

这个是由于可用内存已耗尽,所以终端报出了Allowed memory size of 134217728 bytes exhausted错误,因为PHP默认内存限制是128M,所以需要修改php.ini文件的memory_limit设置。


解决方法

方法1: 找到php.ini配置文件种的memory_limit,把128M修改为256M即可,然后重启即可。

197-2.png


方法2: 通过ini_set函数修改配置选项值 ini_set ('memory_limit', '256M')

目前有 0 条评论

    • 昵称
    • 邮箱
    • 网址