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

WBOY
Release: 2016-06-07 17:17:11
Original
815 people have browsed it

今天在百度知道看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(或更大)

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 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!