简体   繁体   中英

Wordpress Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in /wp-includes/meta.php on line 837

I am new in wordpress. i am getting below error.

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in /wp-includes/meta.php on line 837

while accessing new post page. and also i have added below code in htaccess file.

<IfModule mod_php5.c>
php_value memory_limit 512M
</IfModule>

Please help me to sort out this issue.

  1. Try adding this line to your wp-config.php file: define('WP_MEMORY_LIMIT', '64M');

  2. If you have access to your PHP.ini file, change the line in PHP.ini If your line shows 32M try 64M: memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

  3. If you don't have access to PHP.ini try adding this to an .htaccess file: php_value memory_limit 64M

  4. Talk to your host.

In my case deleting old wordpress post revisions helped. Also you can restrict the amount of revision per article or disable it altogether.

Here's how I did it: Limit or Disable and clean up old wordPress revisions

Debug your WordPress installation with these Basic WordPress Debugging Techniques .

I found many WordPress themes showing this error due to a wildcard searching all through the database. If possible, control the query's posts_per_page from -1 to something reasonable.

And the increment in Memory Limit is sometime a temporary solution if your code is buggy, or giving enormous load to your system that your system is not prepare in handling.

Changing the memory limit is usually only masking the real problem, unless you have it set to some really low value. The problem itself is usually hard to pinpoint.

In my case the problem was caused by someone that set the number of posts per page to some absurdly high value like 999 in my case:

在此处输入图片说明

When I found it the solution was easy - I just decreased it to something reasonable like 100.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM