Home > php教程 > php手册 > body text

Fatal Error: Allowed memory size of 123456789 bytes exhausted

WBOY
Release: 2016-05-25 16:52:18
Original
1156 people have browsed it

错误提示:Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 3214636 bytes) in E:VertrigoServwwwinstall.php on line 488

我们直接创建一个phpinfo.php文件,写入如下代码

<?php phpinfo(); ?>
Copy after login

然后就可以查看到你的内存,php内存分配不足:

1、修改php.ini(推荐):memory_limit = 12M (改大点)

2、运行时修改php的内存设置,在你的php代码中增加以下代码行即可:

<?php 
ini_set(&#39;memory_limit&#39;,&#39;128M&#39;); 
?>
Copy after login

3、在根目录建立.htaccess文件,添加如下内容

php_value max_execution_time 1200 
php_value memory_limit 200M 
php_value post_max_size 200M 
php_value upload_max_filesize 200M
Copy after login

memory_limit应该设为多少?这个完全依赖于你的应用的要求。比如Wordpress,运行起核心代码需要32MB。Drupal 6则要求这个值最小为16MB,并推荐设置为32MB。如果你又安装不少的插件(plugins),尤其是那些要进行图像处理的模块,那么你可能需要 128MB或更高的内存。


文章地址:

转载随意^^请带上本文地址!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!