WordPress内存耗尽错误解决办法

  • A+
所属分类:计算机

今天小样在折腾wordpress时发现一处资源耗尽的一项错误,很坑爹。。通过百度才知道,这种情况在高版本的wordpress中经常发生,也不算是Bug吧?个人觉得应该是大量的插件和主题造成了程序运行时的错误,这里需要对网站根目录下wp-config.php进行修改,如下:

在wp-config.php中加入以下代码即可解决:

define(‘WP_MEMORY_LIMIT’, ’128M’);
英文解释及解决方案:
Increasing memory allocated to PHP
Also released with  , the  WP_MEMORY_LIMIT  option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary in the event you receive a message such as“Allowed memory size of xxxxxx bytes exhausted”.
This setting increases PHP Memory only for WordPress, not other applications. By default, WordPress will attempt to increase memory allocated to PHP to 40MB (code is at beginning of wp-settings.php), so the setting in wp-config.php should reflect something higher than 40MB.
WordPress will automatically check if PHP has been allocated less memory than the entered value before utilizing this function. For example, if PHP has been allocated 64MB, there is no need to set this value to 64M as WordPress will automatically use all 64MB if need be.
Please note, this setting may not work if your host does not allow for increasing the PHP memory limit–in that event, contact your host to increase the PHP memory limit. Also, note that many hosts set the PHP limit at 8MB.
Increase PHP Memory to 64MB
define('WP_MEMORY_LIMIT', '64M');
Increase PHP Memory to 96MB
define('WP_MEMORY_LIMIT', '96M');
When in the administration area, the memory can be increased or decreased from the
WP_MEMORY_LIMIT
by defining
WP_MAX_MEMORY_LIMIT
.
define('WP_MAX_MEMORY_LIMIT', '256M');

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:3   其中:访客  1   博主  1   引用   1

    • 第十一颗行星 第十一颗行星 0

      新主题折腾的不错啊 呵呵

      • webmaster webmaster Admin

        haha哈哈

      • 来自外部的引用: 1

        • nike air dames zwart