Support » Fixing WordPress » Fatal error: Out of Memory

  • Hello,

    I am getting random “Fatal error: Out of memory” errors on my wordpress blog (wordpress 2.9.2). I have disabled a few plug-ins, had my host provider up my php limit to 64M, changed my settings in the files I can find to 64M and it keeps happening sporadically. The most recent errors had an allocated memory size of “(allocated 20971520)” which just happens to be 20M. Somewhere there is a setting that is set to 20M, I just haven’t found it yet.

    I have set the memory limit or made sure that it was set to 64M in the following files:
    php.ini (in root/public_html)
    .htaccess (in root/public_html)

    I installed a memory monitor plug-in, the output is shown below:

    * Usage Sample: 26.18MB (41%)
    * Peak Usage: 26.92MB (42%)
    * All-Time: 30.85MB on 3/25/10 @ 3:59 am (shutdown)
    * Load Averages: 0.54 0.55 0.54
    * WP Memory Limit: 64M
    * PHP Memory Limit: 64M

    This has been happening on and off since the New Year after a particularly large post with pictures. I have been searching for answers on the web and have run out of things to try so I am adsking for some help or direction.

    Thanks in advance for anyones help in this.


    recent captured errors:

    Fatal error: Out of memory (allocated 20971520) (tried to allocate 30720 bytes) in /home/weaver/public_html/wordblog/wp-content/plugins/wp-postviews/wp-postviews.php on line 320

    Fatal error: Out of memory (allocated 21233664) (tried to allocate 122880 bytes) in /home/weaver/public_html/wordblog/wp-content/plugins/wp-postviews/wp-postviews.php on line 757

    Fatal error: Out of memory (allocated 20971520) (tried to allocate 30720 bytes) in /home/weaver/public_html/wordblog/wp-content/plugins/wp-postviews/wp-postviews.php on line 320

    (I disabled wp-postviews plugin after the 3 errors

    Fatal error: Out of memory (allocated 20971520) (tried to allocate 122880 bytes) in /home/weaver/public_html/wordblog/wp-includes/pluggable.php on line 342

    Fatal error: Out of memory (allocated 20971520) (tried to allocate 24577 bytes) in /home/weaver/public_html/wordblog/wp-settings.php on line 601

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi,

    Check with these options:

    1) Please check php.ini file in the root/public_html folder of your site. Open php.ini file in text editor and change the values for memory_limit. By default it should see memory_limit = 8M. Try changing it to 12M. if it wil not resolve the problem then try to increase it either 16M or 24M.

    2) If you can’t find the php.ini file, open up the PHP file which requires more memory and add this line just after ini_set(’memory_limit’, ‘12M’); we can increase memory upto 16M or 24M to resolve the issue. But do it try with 12M first.

    3) In last, open the .htaccess file from the root/public_html folder and add this line php_value memory_limit 12M

    From anyone of these trick you can work and rid out from the PHP error. You can increase memory limit according to your requirement.


    Shane G.

    Thanks Shane

    I have tried the 1st and 3rd options, not sure what is meant by the 3rd one.

    1) from my php.ini in the root folder:
    memory_limit = 64M

    3) from my .htaccess file in the root folder:
    php_value memory_limit 64M

    Not sure about 2 – what line is entered after what?
    “add this line just after ini_set(’memory_limit’, ‘12M’);”

    is (’memory_limit’, ‘12M’); entered on another line after ini_set ???


    I have trying to upgrade since version 2.8.2, getting fed up with failures now, as other things are also giving me memory errors.

    Can’t get past the Fatal error: Out of memory
    Normally it comes up in http.php on or after line 1324 (there is no memory set value in this file – can/should one be added?)

    Always errors around the 18mb mark.
    Running phpinfo:-
    PHP Core
    memory_limit 64M 64M

    This occurs if I try to upgrade WordPress, some plugins, or try to edit a page which now has a ‘large’ amount of text on it (as a txt file = <10kb)

    Update – “Memory Bump” works as far as allowing me to edit my previously edit panel-free page, but not for the install of v3.0

    In the .htaccess file, where exactly do I add the memory limit line?

    This first error message I got said that the php file in question was wp-includes/meta.php. So I tried to open this first but didn’t find the location where to add the line (“just after ini_set” as suggested by Shane G).

    So I decided to do the .htaccess file route instead.

    This is how my .htaccess file looked after adding the line at the end: (Is this correct?)

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule . index.php [L]
    # END WordPress
    php_value memory_limit 64M

    I saved this then refreshed. But when I went back to my wp-admin, I got this error message: Internal Server Error 🙁

    Now, I can’t access my sites (both actual sites and wp-admins) with the domain name in question, all of them showing this internal error message. (Panic mode!!!)

    Would greatly appreciate your help Shane G, or anybody please….desperately need help.

    Thanks in advance!

    Ok, I contacted my host and he told me that my memory limit is already 64M. I was also able to check it myself via phpinfo. I was also told that since I’m on shared hosting, I can’t go beyond 64M anymore.

    Now I am already able to access my sites and wp-admin. However, I still see this message whenever I add a new site using a new subdomain:

    fatal error: out of memory (allocated 66846720) (tried to allocate 35 bytes) in /home/maxlife/public_html/ on line 310

    How do I address this please?

    add this to top of wp-config.php right after opening <?php
    define('WP_MEMORY_LIMIT', '128M');
    this should give you temp memory increases as needed

    Thanks for the quick reply. I did what you said, added the line to the top and this is how the upper part looks like after the edit:
    define(‘WP_MEMORY_LIMIT’, ‘128M’);
    * The base configurations of the WordPress.
    * This file has the following configurations: MySQL settings, Table Prefix,
    * Secret Keys, WordPress Language, and ABSPATH. You can find more information
    * by visiting {@link Editing
    * wp-config.php} Codex page. You can get the MySQL settings from ….

    However, I still got this error message after I refreshed and tried to create a new site:

    Fatal error: Out of memory (allocated 67108864) (tried to allocate 35 bytes) in /home/maxlife/public_html/ on line 310

    Would you have other suggestions please?

    Thanks again…

    OK, my problem just got solved!!!

    Got it from this, thought I’d share it with you guys :

define(‘ABSPATH’, dirname(__FILE__).’/’);

    define(‘WP_MEMORY_LIMIT’, ’64M’);


    memory_limit = 128M; Maximum amount of memory a script may consume (64MB)

    max_execution_time = 45;

    upload_max_filesize = 10M;

    post_max_size = 20M;

    Hope this helps!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Fatal error: Out of Memory’ is closed to new replies.