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!

6 Comments

  1. Posted December 24, 2007 at 10:34 am | Permalink

    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. Posted August 3, 2008 at 6:46 pm | Permalink

    stupid questionn… I cannot find my .htaccess file ?

    Where should it be?

  3. Posted August 5, 2008 at 8:08 am | Permalink

    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. Posted November 5, 2008 at 1:24 pm | Permalink

    This fix worked for me. Thanks very much for this post. You saved my neck!

  5. Montxo
    Posted August 25, 2009 at 4:01 am | Permalink

    Thanks for your fix, it worked quickly for me.

  6. Posted December 24, 2011 at 2:52 pm | Permalink

    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!

One Trackback

  1. […] The .htaccess solution to fixing PHP Memory […]

Post a Comment

Your email is never shared. Required fields are marked *

*
*