Skip to content

Fixing the PHP Allowed Memory Size Exchausted Fatal Error in WordPress

When I logged on to post an update today, I was greeted with the error message:
Allowed memory size of 8388608 bytes exhausted (tried to allocate 208834 bytes) in /public_html/*
(where * represented the path to any file in the wp-admin portion of one of my blogs). The content/end-user portion of the blogs were showing up just fine, I just couldn’t write any new content or make changes.

My initial research said that I would need to get my hosting company to increase the memory allocation of PHP on the server, or add the line ini_set("memory_limit","16M"); to any offending .php file. Since my hosting company is takes days to get to any problems, and I was having this issue with every .php file in the /wp-admin/ directory, these seemed like non-solutions. When I came across the idea of adding php_value memory_limit 32000000 to my .htaccess file, my hopes of a quick fix were restored. I added the line to the .htaccess file in the root of my website (/public_html) and the problem disappeared instantly, for all of my blogs hosted on this server. Hurray for quick, easy fixes!

7 thoughts on “Fixing the PHP Allowed Memory Size Exchausted Fatal Error in WordPress”

  1. I posted this to my .htaccess file

    php_value memory_limit 32000000

    And could not access anything on my website until I removed it. So I just started deactivating plugins to get rid of the Memory Fatal Error.(The culprit that caused the problem was FeedWordPress Plugin)
    Arthur

  2. Pingback: Fatal Error: Memory Exhausted (WP Fix!) « Blog Elite: Showing the ways of the pro’s

  3. Brett – the .htaccess file should be in the root directory of your WordPress installation. There usually is also on in the root directory of your web server as well.

  4. Make sure this line is in your wp-config.php file after the
    define utf
    define(‘WP_MEMORY_LIMIT’, ’64M’);

    That’s how I fixed mine. When wordpress moved up to 3.0 that specification in wp-config.php became important and if you had the permission set to 444 on that file it never got the added code. Opps!

Leave a Reply

Your email address will not be published. Required fields are marked *