WordPress – Fatal error: Allowed memory size of bytes exhausted
Does your WordPress site show a message similar to this?
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 19456 bytes) in wp-admin/includes/theme.php on line 81
If your answer is “yes”, this tutorial is for you.
We’ve helped several of our students with similar issues so we decided to write a tutorial to hopefully help someone else out as well.
Before starting to read this guide, it’s worth understanding what PHP errors are in WordPress.
Background Information About PHP Memory Limit
PHP Memory limit sets the maximum amount of memory in bytes that PHP allows to allocate to a script. This prevents poorly written scripts for eating up all available memory on a server.
In most cases, if you get a memory limit error it’s due to a faulty plugin. If you’re at 32 or 64 M limit, that should be more than enough.
If you set it to 128 M and still getting the error, then you for sure know it’s due to a faulty plugin. So the key question is what plugin did you install prior to this?
Things to Try
- Try adding this line to your wp-config.php file:
- If you have access to your PHP.ini file, change the line in PHP.ini
If your line shows 32M try 128M:
memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
- If you don’t have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 128M
- Talk to your host.
- If you have just updated a plugin and you’re seeing errors, try rolling back to a previous version.
Plugin for Keeping Track of Memory Usage
Use the TPC! Memory Usage plugin to track the memory usage in your WordPress.
TPC! Memory Usage allows WordPress administrators to view the current and peak memory usage of the application. This is extremely helpful when testing new plugins, or if there are a lot of modifications, plugins, or large language files. As of version 0.4, administrators now have the ability to view detailed system information about their web server, MySQL, PHP, and WordPress software. Chris Strosser”
This worked like a charm. I had to install a wp site on networksolutions and had many snags. this was an easy fix. Thanks for the solution
The ‘things to try’ did not work for me, but the suggestion that it could be a faulty plugin led to a solution.
I found a few posts reporting that ‘wp super cache’ causes memory usage to soar, and sure enough, the fatal error messages disappeared when it was uninstalled. Sometimes best friends can make worst enemies..
I also had to deactivate “wp super cache” in order to have the WP work properly. I was searching the last few days for answers on how to increase memory (which did not work). Finally I decided to deactivate…….