This pesky error code “Allowed Memory Size of 33554432 Bytes Exhausted” is I think the bain of every WordPress website owner. There are several reasons for it and can happen at any time. This week it happened to me.
I went to my Dashboard like a do every morning, and scrolled down and I saw Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate xxxx bytes) in xxxx files.
If this happens to you try the following 3 Fixes:
1. Adjust memory limit in php.ini
Find the php.ini file in the root of your server, or if you are running on IIS7 it might say php5.ini. You will need an FTP (File Transfer Protocol) program to move and edit the file offline to your desktop. Open the file in an editor like Notepad and search for memory_limit. If the memory_limit doesn’t exist, add the following line. If it’s there, modify the value of the memory_limit:
memory_limit = 32M
Save the file and FTP the file back to the root of your website.
This did not work for me. On to Fix #2.
2. Deactivate/Activate plugins
There might an issue(s) with your plugins on the WordPress website. I recommend to deactivate all that you are not using or don’t absolutely need first. Each plugin you deactivate, check back at where you are seeing the error and see if it goes away. For me, I was seeing it on the Dashboard. One by one I went through and deactivated 10 out of the 16 plugins. Part 2 of this Fix is to reactivate them. Again checking each time to check for the Fatal error to disappear.
This didn’t work for me either, but might work for you.
3. Set memory limit in wp-settings.php or wp-config.php
Download from the wp-settings.php or wp-config.php from your server using FTP. Open the file using a text editor like Notepad, and add the following code:
ini_set(‘memory_limit’, ’64M’);
I put this code in the wp-config.php file at the very top of the page, right under the first <?php>, uploaded that to the server overwriting the one on there. Checked on the error, and just like that – it disappeared.
If none of the above fixes work for you, it’s time to chat with your hosting provider and ask them to increase the memory limit of your website.
Have you experienced a Fatal error on your WordPress site?