Fatal error: Allowed memory size of 8388608 bytes exhausted解决方法

当内存请求超出8M限制的时候,php会抛出这个错误,这是一个很容易解决的问题。

解决办法(三种):

(1)改变php内存限制,只需要在你的程序头部加入: ini_set("memory_limit","12M");
The 12M sets the limit to 12 megabytes (12582912 bytes). If this doesn't work, keep increasing the memory limit until your script fits or your server squeals for mercy. 
You can also make this change permanently for all PHP scripts running on the server by adding a line like this to the server's php.ini file: 

(2)你同样可以修改你的php.ini文件: 
memory_limit = 12M
Keep in mind that a huge memory limit is a poor substitute for good coding. A poorly written script may inefficiently squander memory which can cause severe problems for frequently executed scripts. However, some applications are run infrequently and require lots of memory like importing and processing a big data file.

(3)在根目录建立.htaccess文件,添加如下内容
php_value memory_limit 12M

如果还不能解决,就把它改得再大一些。
最后注意的是重启服务器。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值