Fixing “Fatal Error: Allowed memory size of 33554432 bytes exhausted”
After updating to WordPress 2.8.6, I received an error telling me that my “Allowed memory size of 33554432 bytes was exhausted (tried to allocate 30720 bytes)” when I tried to access my site’s admin page. Thankfully, this only appeared on my site’s backend, but there are a lot of WordPress users who have had similar (if not identical) issues. So, I’ve put together a little how-to walking you through all the things that could be causing the restriction in memory.
What is this error, exactly?
Everything on your website takes up a little bit of memory. The biggest culprit of this are plugins, which often times are the easiest answer to the problem; if you have a lot of active plugins, just deactivate a few! Regardless, plugins aren’t the only thing that can cause memory overflows; things like excessive animations, or inefficient scripts. Your page might even have too many images, but it would take quite a lot of content like this to demonstrate this issue.
Interestingly enough, there is a surprisingly simple way to fix this issue. You just need to enter a line of code in a few places so that your wordpress install knows to allocate more memory. Here’s a solution, in a few simple steps:
1. Open your FTP browser and navigate to the folder/directory that you installed WordPress in. From there, locate “wp-config.php”. You’ll need to open it in whatever editor you like. Once you’ve done this, enter the following code somewhere close to the top:
Check to see if the error is resolved. If not, go on to step 2.
2. In your FTP browser, navigate to your root folder (it’s usually /public_html/ or /www/) and look for a “PHP.ini” file. You’ll need to find a line like this:
memory_limit = 12M
Change “12M” to “32M” to allow the PHP scripts WordPress runs to access more memory. If this doesn’t work, try changing it to “64M”. If you still have issues, and you have access to your webserver, it might be necessary to restart your webserver. If this doesn’t work, or you don’t have access to your webserver, then you’ll need to go ahead to step 3.
3. We’re going to edit your /install.php file. You can find this file in the root directory of your site, or in whichever directory/folder you installed WordPress in. You’ll need to add the following line to the beginning of the file:
When you are finished, the beginning of the file should look like this:
* WordPress Installer
* @since unknown
* @var bool
If this still doesn’t work, try changing “32M” to “64M”. If you’re totally at a loss for ideas, I’d recommend contacting your site’s host and asking them if there’s any issues with your server. If you have access to your administrative control panel, you might want to try disabling any extraneous plugins, as well.
It’s always a good idea to be tidy and prudent. Delete anything you don’t need or that doesn’t need to be archived. Get rid of plugins that you don’t use, and update any old plugins (often times, plugins are optimized between versions, to run smoothest with the latest versions of WordPress). This saves you from issues when you upgrade your site. If this article helped, or if you need some extra assistance, post a comment! I’d appreciate it.