admin管理员组

文章数量:1406177

I'm using WordPress for a personal website. A couple of days ago, I made some basic HTML and CSS changes to one of my pages (such as changing margins and an H3 into an H2), but now, every time I access that page, I get this error (which I only see on this page, none of the others have any issues).

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 62914592 bytes) in /www/volleyballandme_311/public/wp-includes/class-wpdb.php on line 1812

I've tried accessing the wp-config.php file and adding define('WP_MEMORY_LIMIT', '512M'); but the error persists. I've also run WP Sweep to clean unused and unnecessary files, but the error persists.

What are some other things I can do in order to fix this error and visualize the content? Thanks for your help!

I'm using WordPress for a personal website. A couple of days ago, I made some basic HTML and CSS changes to one of my pages (such as changing margins and an H3 into an H2), but now, every time I access that page, I get this error (which I only see on this page, none of the others have any issues).

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 62914592 bytes) in /www/volleyballandme_311/public/wp-includes/class-wpdb.php on line 1812

I've tried accessing the wp-config.php file and adding define('WP_MEMORY_LIMIT', '512M'); but the error persists. I've also run WP Sweep to clean unused and unnecessary files, but the error persists.

What are some other things I can do in order to fix this error and visualize the content? Thanks for your help!

Share Improve this question asked Mar 6 at 14:59 Danilo.MicucciDanilo.Micucci 819 bronze badges 6
  • This can't come from HTML or CSS changes... – Honk der Hase Commented Mar 6 at 15:03
  • Those were the last changes I made before the page presented that error. It's a static page with information, so I don't really understand where the issue could be! I have looked at other Stack Overflow posts regarding similar issues, and I've looked in YT was well, but nothing has been able to fix my problem. – Danilo.Micucci Commented Mar 6 at 15:05
  • Hard to tell from the outside what you've done. Can you revert the changes or have a backup? It's probably your best option. – Honk der Hase Commented Mar 6 at 15:26
  • I think I'll have to go back to a previous version, but it sucks that I'll have to do that every time this happens – Danilo.Micucci Commented Mar 6 at 15:35
  • 4 FWIW, in my experience with WordPress and PHP in general, OOM errors are rarely fixable by changes to the maximum amount of memory after 256MB, and are instead related to some form of infinite loop. I say this knowing that it doesn't help you that much, but I just wanted you to know that chasing WP_MEMORY_LIMIT probably won't solve your problem. – Chris Haas Commented Mar 6 at 16:01
 |  Show 1 more comment

1 Answer 1

Reset to default 0

There are two hints in the error message that are worth pursuing the investigation:

  • "tried to allocate 62914592 bytes"
    it's not some random string concatenation that, willing to reserve 10 bytes, gets the bad luck of being the one that makes total memory consumption exceed the limit after ten other million concatenations did the same;
    here it's something trying to get a 62 MB memory block at once: an image processor loading a big photo in memory, an unzip of a 10 MB file, a dump of a database…
  • "class-wpdb.php on line 1812"
    Well, with such a name, it looks like the culprit is something reading a big chunk from a database.

With that all, the first thing you have to do is go look at line 1812 of the file /www/volleyballandme_311/public/wp-includes/class-wpdb.php. We can't do it for you (even if we knew your WordPress version this would be complicated to find the exact same as you).

If, as assumed, this crashes in a function reading the results of an SQL query, find which query (a quick way would be to add a file_put_contents('/tmp/queries.sql', $theVariableHoldingTheQuery."\n", FILE_APPEND); before what looks like the call to the database some lines before line 1812).
Then try to run the query (the last one written in file /tmp/queries.sql) directly in your database (without PHP), to see if its result is that big.

If yes, it will be up to you to understand why you have so much data in that table: is it expected? If yes increasing the memory limits will help, if no purge your data.

本文标签: