PHP错误Allowed memory size of 67108864 bytes exhausted的3种解决办法,67108864exhausted_PHP教程

WBOY
Libérer: 2016-07-13 10:22:09
original
1385 Les gens l'ont consulté

PHP错误Allowed memory size of 67108864 bytes exhausted的3种解决办法,67108864exhausted

今天在百度知道看php相关资料时发现一个网友问一个wordpress安装提示错误的一个问题,说他在安装wordpress安装包时遇到这样一个问题:Fatal error:Allowed memory size of 67108864 bytes exhausted (tried to allocate 76 bytes) in…..这个问题小编以前没遇到过,根据提示肯定是内存溢出造成的。至于为什么会出现这样的提示呢?下面我把自己整理的出错原因和解决办法给phper分享一下,希望有所帮助。

出错原因:

因为php页面消耗的最大内存默认是为8M (在PHP的php.ini配置文件里可以看到) ,如果文件太大或图片太大,在读取的时候会发生上述提示错误。

解决办法,个人目前知道的有三种解决方案:

第一中解决方案是:在PHP文件中加入ini_set(”memory_limit”,”80M”);当然80M可以根据自己的情况改动,也不要太大哦,否则系统其它资源会遇到问题哦,其中-1为不设限。

第二中解决方案是:修改 php.ini配置文件,在php.ini中找到

复制代码 代码如下:
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit

memory_limit = 16M,将前面的分号去掉,改动值的大小,将memory_limit由8M改成16M(或更大),重启apache服务即可。

第三种解决方案是:修改.htaccess分布式配置文件(注意哦:前提是该目录支持.htaccess)。在文档中新增一句:php_value memory_limit 16M(或更大)

Allowed memory size of 67108864 bytes exhausted (tried to allocate 35 bytes)

Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 问题是WP_MEMORY_LIMIT定义的小了,但是目前网上的方法都是叫改wp-settings
 

php内存不够用,出现Allowed memory size of 8388608 bytes exhausted (tried to allocate 1298358 bytes)

出现该错误的原因:

是因为php页面消耗的最大内存默认是为 8M (在PHP的ini件里可以看到) ,如果文件太大 或图片太大 在读取的时候 会发生上述错误。

解决办法:

1,修改 php.ini
将memory_limit由 8M 改成 16M(或更大),重启apache服务

2,在PHP 文件中 加入 ini_set(”memory_limit”,”100M”);

注意:为了系统的其它资源的正常使用 请您不要将 memory_limit设置太大,其中-1为不限

3,修改.htaccess 文档(前提是该目录支持.htaccess)
在文档中新增一句:php_value memory_limit 16M(或更大)
 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/851342.htmlTechArticlePHP错误Allowed memory size of 67108864 bytes exhausted的3种解决办法,67108864exhausted 今天在百度知道看php相关资料时发现一个网友问一个wordpress安装提...
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!