It is about technology!
 Subscribe to Feed

WordPress Fatal error: Out of memory

This is a common error message thrown in when someone tries to view your WordPress-driven blog/site. This also happens while you are in the middle of doing some work on the admin interface or writing your entry and saving it.

The reason is that some activity in the back end is eating up the memory allotted by the server set up for PHP processes and/or MySQL database operation. It may be due to multiple processes trying to operate simultaneously.

Now to the remedy:

There are several fixes suggested in different blogs. Most of them talk about either modifying the php.ini file in the PHP installation on the server or tweaking the wp-settings.php in the WordPress core.

While 99% of the WordPress users are in a shared hosting environment, access to php.ini file of the host set up is out of question. so forget about it.

Let s now discuss various types of remedies obtained through a Google search.
Audio Visual Junkie focuses on the flooding of “wp_options” table in the database with entries like “rss_f07b6018d7bc77b2520b5ec4296f3e66_ts” which seemed to cause the memory problem. It also feels that certain plugins cause such bloating of the table.

The blog suggested complete flushing of such entries out of the options table, by running this SQL query:

DELETE FROM `wp_options` WHERE `option_name` LIKE “rss_%”

Though there is a word caution expressed since such indiscriminate removal of all options starting with RSS would cause your blog’s feeds being not valid. Mittineague had suggested use of “Clean Options Plugin” for judicious removal of such unwanted entries in options table.

Narfstuff suggests a few sane ways to get into the root of the problem. One of them is to divine what exactly the memory limit allotted by the web host for PHP based processes by creating a phpinfo.php file with the snippet as follows:

and placing it in the root directory. When called through the browser, it will display the entire PHP and MySQL environment. Search for the value against “memory_limit”. If it shows more than 64MB, you are good. Most good web hosts allot 128MB. But this will not help prevent throwing up of error when one of your WordPress processes consume even 2.5 MB because of various other parameters coming into play while executing WordPress commands which have not been explicitly stated anywhere! But it may be due to the server overload at the time of taking backups etc.

Narfsurf also analyses the generic issues thus:

Test to see whether there is any improvement after:

* Taking Plugins Offline.
* Switching large sections of the site onto ‘Draft’ mode (i.e pages with large quantities of sub-pages).

It is worth pointing out that whilst low PHP memory can be the root of rendering problems, it can also be the case that a badly written plugin or modification to WordPress’ core code may munch its way through vast swathes of system RAM. It’s important to make certain that any code is well formed and written, before placing blame on the package’s low memory.

When reducing WordPress’ memory footprint, there’s a few tricks that can help us to make progress. Converting tags such as bloginfo(’template_directory’) to their hard coded counterparts can help reduce system load, and Disabling plugins which aren’t core to the operation of the site.

Perishable Press has come up with a few solutions like assigning a higher value to the memory_limit parameter in .htaccess file and php.ini files in specific directories where the problem occurs.

My web host, the friendly did a Goggling on my behalf and came up with this web site containing a solution to the memory_limit problem.

The site suggests tinkering with wp-settings.php file which is part of the WP core which will get overwritten on every upgrade, which is of course, once in a couple of months. Hence it is not a desirable solution. But you can find a cue from that suggestion. To wit, the lines of code in wp-settings.php that is asked to be changed reads thus:

if ( !defined('WP_MEMORY_LIMIT') )
define('WP_MEMORY_LIMIT', '32M');

It reads that if the memory limit had NOT been defined (negativity indicated by the “!” sign), define it now. The default value is 32MB. It can be increased to 64 or even 128 MB depending on your choice and what your web host allows.

Hence the best option would be to define it in the first place as enumerated in the following FAQ offered by MichaelH:

Fatal error: Allowed memory size of xxxxxxxx bytes exhausted
If deactivating plugins doesn’t work try one of these methods for increasing the amount of memory a PHP script may consume

1. 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)

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

3. Try adding this line to your wp-config.php file:
Increasing memory allocated to PHP
define(‘WP_MEMORY_LIMIT’, ’64M’);

4. Talk to your host.

As for me I did item no. 2 and 3 and did talk to the host who was very helpful. So far so good!

(Picture courtesy: Austin Passy.)

Tags: , , , , , , , , ,

7 Responses to “WordPress Fatal error: Out of memory”

  1. The Frosty says:

    Thanks for the little write up.
    I’ve seemed to get passed the memory issue and have now come to an new “IO error” in every upload, including simple small photos. Oh well, guess it will never be perfect.

  2. Thank you for this. Few of my clients got this error.
    It seems that this often appear on the same web hosts.

  3. Sie finden unsere Station im Zentrum der Stadt, direkt neben der Sparda Bank am
    Zehmeplatz 11a und nur 800m vom Bahnhof entfernt.

  4. This piece of writing provides clear idea
    designed for the new viewers of blogging, that truly how to
    do blogging and site-building.

  5. CaPiToRqZ says:

    OPTION TO Typical Synthetic Supplements IS NECESSARY, Say Experts
    Whole dietary supplements is currently a subject of worldwide interest. A profusion of evidence has recently emerged suggesting that ordinary synthetic multivitamin supplements may be hazardous to your health. Goran Bjelakovic, a well known scientist from the University or college of Copenhagen, headed up an enormous meta-study that viewed the results of 67 placebo-controlled trials previously undertaken to determine the effects of supplement and anti-oxidant supplements on longevity. In the end, the study mixed observations of 232 000 test subjects. Through the use of such a big population sample, a report can become much more powerful with regards to spotting large-scale developments and overcoming individual bias.
    The results of the analysis, published in the Journal of the American Medical Association, were nothing less than shocking. Taking a look at patients with diabetes, heart disease and lung tumor, as well as healthy, normal individuals, there was no apparent benefit to taking popular fractionated supplements like Vitamin A, Vitamin E, Vitamin C, Selenium, or beta-Carotene. Actually, the results went in the opposite direction – there was a greater chance of death (16 percent) among Supplement A users, a 7 percent higher death rate among beta-Carotene users, and a 4 percent mortality upsurge in Vitamin E users. Beta-Carotene and Retinol, marketed as anti-carcinogenic agents, may promote lung cancers. That’s right – pills marketed as assisting you towards an extended, healthier life are in fact correlated with a speedier demise. This study used typical supplements on the market made from synthetic vitamins.
    To add salt to the wound, a recent research published in the Uk Journal of Diet under the unimaginative title of “Ascorbic Acid Supplementation WILL NOT Attenuate Post-Exercise Muscle Soreness Following Muscle-Damaging Exercise But May Delay The HEALING PROCESS” indicated that supplementation with anti-oxidants from synthetic sources may reverse many of the beneficial effects of physical training.
    Now, this is not to say that vitamins or anti-oxidants are harmful to you. Far from it – these supplements were created on the basis of solid science. Anti-oxidants are thought to protect cells from the ravages of free radicals still. The problem, rather, is the idea that you can get those benefits from synthetic isolated substances. Disease and growing older are usually far more complicated than test-tube studies can take into account. Furthermore, the presssing problem of bioavailability can be an ever-present concern. Many typical synthetic supplements include large sums of the advertised vitamin, but absence the additional substances had a need to ensure that their key substances are actually absorbed by your body. Passing through the digestive tract right, these ‘miracle health remedies’ often wind up doing little beyond giving people expensive urine. To the rescue…Whole Food Supplements.

Leave a Reply

Copyright © HyperCircle 2009 | Powered by Wordpress | Designed by Elegant Themes