Your WordPress website needs computer memory to function. Sometimes, the memory allocated may not be enough to run your site and you will see a WordPress memory limit error like this:
fatal error: allowed memory size of 67108864 bytes exhausted
A second error that indicates low memory in WordPress is the White Screen of Death. If your site doesn’t function and all you see is a white screen, it is possibly because WordPress is running out of memory.
In this article, we explain what causes “Fatal Error: Allowed memory size of bytes exhausted in WordPress” and the simple steps you can take to fix it.
- What Causes Fatal Error: Allowed Memory Size of Bytes Exhausted in WordPress?
- How to Fix This Error.
What Causes Fatal WordPress Memory Limit Error: Allowed Memory Size of Bytes Exhausted?
Web servers set a limit on the amount of computer memory that can be assigned to a script.
Limiting memory is a necessary feature to protect servers. Web servers need enough memory to run many applications at the same time. PHP being one of the applications can only be assigned some of the server’s memory.
If memory used by PHP scripts is not limited, a poorly written script can consume the entire memory. This would crash the server and make your site and every other site on that server inaccessible.
Since WordPress is made up of scripts written in PHP, it is bound by the memory limits set for PHP scripts.
Thus, if one of your scripts needs more memory than can be allocated, it runs out of memory and you see the WordPress allowed memory size exhausted error.
When this happens, you can almost always trace the problem to a plugin, or in some cases, a theme. It is unlikely that your core WordPress scripts would need more than the allocated memory to run.
How to Fix This WordPress Memory Limit Error
There are two basic ways to fix Fatal Error: Allowed Memory Size of Bytes Exhausted in WordPress. You can either increase the WordPress memory limit or get rid of the script that requires more memory. Check our beginners guide below:
Increase PHP Memory Limit in WordPress – the Easy Fix
This error indicates your site ran out of memory. The obvious way to fix this is by increasing the amount of memory that can be allocated to a script.
By design, WordPress first tries to increase your memory limit to 64mb. Seeing this error indicates this size is still not enough, or in some cases, your server prevents the allocation of more memory.
You can manually increase memory limit in WordPress by editing the wp-config file.
To do this, connect to your site using FileZilla FTP Client. If you are not sure how to create the connection, watch this video: How To Use FTP.
When connected, your site folders and files will be displayed in the bottom right of your screen. Look for the folder containing all your WordPress files and double-click to open it.
In this folder, locate your wp-config file, right-click on it, and click View/Edit.
When the file opens in your text editor, scroll towards the bottom to find the line that says “That’s all, stop editing! Happy blogging.” Paste the following code above that line.
define( ‘WP_MEMORY_LIMIT’, ‘128M’ )
Save this file and close the editor. FileZilla will prompt you to upload the edited file. Click Yes.
Now reload your site. The problem should be fixed and your site should display properly.
Note: The line we added above increased the memory to 128megabytes. If you still get the error, then this memory size may still be insufficient. You can fix this by changing the PHP memory limit to 128M, 256M, or even 512M.
Alternate Solution – Find the Script Causing the Error
The fix above can help you quickly get out of this issue. But there are situations where it is better to find the script that requires more memory and delete it.
If, for example, you need to increase the allocated memory above 256M, then that script is already taking too much memory. This could ruin your site performance.
In some cases, your host may not permit you to increase memory at all. If this is so for you, the quick fix above will not solve the issue. In this case, you can contact your host and ask them to increase the memory. Or better yet, you can track down the memory hungry script and get rid of it.
The first place you want to look to find this script is your plugins. If you installed a WordPress plugin shortly before this error occurred, then that is most likely the cause.
Read this article to see how to know if a plugin is the cause of your issue, and how to locate and delete the plugin: How To Disable WordPress Plugins Using FTP.
More often than not, a plugin would be responsible. If you, however, go through the steps to disable plugins and it doesn’t solve the problem, then the next place to look is your currently active theme. Read this post to learn how to find out if your theme is the cause of your WordPress memory issues, and how to fix it: How To Disable WordPress Theme Using FTP.
How Can You Use This Information
The steps covered in this guide can help get you out of the WordPress memory exhausted error. The quick fix (increasing WordPress memory) would be suitable in most cases.
However, if you are concerned about performance (e.g. the speed of your site), the better fix is finding the script that’s taking too much memory and getting rid of it. Our second solution would help you do this. You may also read our WordPress Speed Guide to learn how to increase your site speed.
Are you still seeing this error after going through all the steps? Then you may need professional help. Request our Premium WordPress Support Service and one of our programmers will get to work immediately and fix it for you.