Get Out of the PHP Memory Error Rut with WordPress


We’ve all been there: You drag yourself out of bed in the morning, crawl to your computer, and boot up the oh-so-familiar blog space. But instead of finding your lovingly crafted website, complete with self-made logos and beautiful banners, all you find is this error:

Fatal error: Allowed memory size of ######## bytes exhausted (tried to allocate ## bytes) in /home/user/public_html/wp-includes/phpfile.php on line 80.

Before you start swearing at your monitor or worse—we’re thinking that stapler looks appropriately weighted for some hefty hucking—know that this issue is easily fixed, and doesn’t have to be the day-wrecker you feel it might be.

RELATED:   What You Should Know About Drupal

It’s worth noting that your exact error message may vary, but as long as it says something about your memory being more worn out than an obese man at a 10k, you’re golden: The issue has to do with available computing space, and you’re still reading the right tutorial.

The likely issue is that you’ve just installed a new plug-in or extension, and now WordPress is acting like an estranged lover. There are a couple of ways to correct the issue. The easiest is to disable any recently installed extensions and see if that corrects the problem. However, this is certainly less than desirable, as you likely want that new piece of code. With that in mind, you might try to expand the available memory space for your site. This can be accomplished in the following way:

RELATED:   The 13 Best Free WordPress Plugins

Essentially, you’ll need to change the amount of memory available for PHP. This can be done in a number of ways, and it might be that there’s only one that works for your server. Always query your web host first—or if you’re feeling gung-ho, locate your php.ini file and do this to it!

Locate the following line:

[code lang=”php”]memory_limit = 32M ; Maximum amount of memory a script may consume[/code]

Change “32M” to “64M,” and then cross your fingers. Some hosts limit the amount of memory you can delegate yourself to PHP, so if this doesn’t correct the issue, therein may lie your problem. If you can’t acquire access to php.ini, you might try adding the same line to the .htcaccess file in your WordPress main installation folder.

RELATED:   When to Transition to a Content Management System

If none of those are possible, then you’re in a sticky boat, Pilgrim: Call up the tech-support you’re paying for and get them to do one of the things we just discussed.

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>