Fatal error: Allowed memory size of 33554432 bytes exhausted_PHP教程

WBOY
Release: 2016-07-13 10:43:08
Original
960 people have browsed it

今天换了一个服务器运行php久了就会发现Fatal error: Allowed memory size of 33554432 bytes exhausted提示了,下面我来给大家介绍此问题解决地。

解决办法


方法一(推荐)、修改 php.ini 里的 memory_limit 的设置值 8M 改为 120M:memory_limit = 120M

方法二、在最上层的 PHP Script,加入一行:ini_set("memory_limit","120M");


我使用的是否wordpress博客,我的解决办法有点不同,下面也分享一下。

1、网络办法,据说这个适用3.0以前的版本。编辑wp-config.php这个文件,添加

 代码如下 复制代码

define(‘WP_MEMORY_LIMIT’, ’64M’);

64M可以更高。可以96M、128M。

2、3.0以后的版本,要修改源文件,介意的就不用改了。在wp-includes目录下找到default-constants.php文件中的以下的代码

 代码如下 复制代码

global $blog_id;

// set memory limits
if ( !defined('WP_MEMORY_LIMIT') ) {
if( is_multisite() ) {
define('WP_MEMORY_LIMIT', '64M');
} else {
define('WP_MEMORY_LIMIT', '32M');
}
}

第二行 define(‘WP_MEMORY_LIMIT’, ’32M’); 变64M即可。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/633193.htmlTechArticle今天换了一个服务器运行php久了就会发现Fatal error: Allowed memory size of 33554432 bytes exhausted提示了,下面我来给大家介绍此问题解决地。 解决办...
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!