Heim  >  Artikel  >  php教程  >  Fatal Error: Allowed memory size of 123456789 bytes exhausted

Fatal Error: Allowed memory size of 123456789 bytes exhausted

WBOY
WBOYOriginal
2016-05-25 16:52:181157Durchsuche

错误提示: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(); ?>

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

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

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

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

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

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


文章地址:

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn