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

多试试:多试试-计算机技术与软件


http://www.njustjx.cn/thread-3727-1-1.html


dz备份时出现的问题,当内存请求超出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

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

你可能感兴趣的:(php)