wordpress前台或后台出现Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate xxx bytes) in xxx.php on line xxx的解决办法
打开wp-includes目录下default-constants.php文件,找到如下代码

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

if ( ! defined( ‘WP_MAX_MEMORY_LIMIT’ ) ) {
define( ‘WP_MAX_MEMORY_LIMIT’, ’256M’ );
}

然后把define(‘WP_MEMORY_LIMIT’, ’32M’);这个32M修改为64M,保存,覆盖原来的文件,修改后如下图:

如果还是不行,可以修改成96M、128M或更大。
注意:请不要使用Windows系统自带的记事本修改代码,推荐使用Notepad++、UltraEdit、EditPlus等编辑器修改,cPanel用户可以直接在cPanel文件管理器Edit。

分享到: 更多

2
说点什么

avatar
2 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
0 Comment authors
Recent comment authors
  Subscribe  
最新 最旧 得票最多
提醒
Better Man
游客
Better Man

网上试了很多方法,根本不管用,这是你们的教程给力!!一下解决了!谢谢。

王可欣
游客

的确有效 赞…