Today, we’ll explore the most straightforward steps to fix the famous WordPress Memory Exhausted Error.
Stumbled upon a WordPress Memory Exhausted Error message? That’s probably because your site has gone haywire. This WordPress Exhausted Memory Error occurs mainly when you upload a new plugin, theme, or large file.
This may sound frightening, but such an error is among the most ordinary WordPress errors you can experience.
WordPress runs using PHP; like any application, it requires memory to execute without glitches. Extremely low memory on your site will give you the dreaded exhausted memory error in WordPress operating on PHP 5.6 or above.
You may encounter these two types of WordPress Memory Exhausted Error when adding a new file:
- Fatal error: /path/to/script’s allowed memory size of X bytes was used up (x bytes were attempted to be allocated). For Example, a Fatal error allowed a memory size of 134217728 bytes to exhaust wordpress.
- PHP Fatal error: /path/to/script: Out of memory (allocated X) (tried to allocate Y bytes)
But relax; the steps mentioned in this guide on fixing WordPress Memory Exhausted Error have you covered.
What Causes the WordPress Memory Exhausted Error?
Before coming to the fixes, I would like to tell you a little about the causes. WordPress, by default, allocates a certain amount of memory. If your site has:
- Too many plugins active
- High-resolution images and media
- Resource-heavy themes
- Background tasks like backups or updates running at the same time
These can push the memory beyond its limit, resulting in the WordPress jetpack fatal error, allowing memory size of exhausted message.
14 Steps Checklist to Fix the WordPress Memory Exhausted Error
1. Backup Your Site First
Always back up your WordPress site prior to editing. It means you can restore your website if anything goes wrong while editing. In case you forgot to back up your site, contact your WordPress hosting service providers.
2. Check Your Current PHP Memory Limit
To know if your memory is low, follow these steps:
- Go to WordPress Dashboard.
- Navigate to Tools → Site Health → Info.
- Scroll to the Server and check the PHP memory limit.
You’ll need to increase it if it’s less than 128M or 256M.
3. Editing the wp-config.php File
The WordPress core file, wp-config.php, contains your website’s fundamental setup information. It includes the MySQL database settings, ABSPATH, and database table prefixes.
To fix the memory exhausting problem in WordPress, you have to alter the memory limit in your website’s wp-config.php file. Connect to your server to retrieve the file using FileZilla on an FTP client or through cPanel.
I will guide you through the troubleshooting process of this problem.
This method works for most users:
- Use FileZilla or your web hosting’s cPanel File Manager.
- Now, go to the public_html folder.
- Find the wp-config.php file.
- Locate the line that says:
/* That's all, stop editing! Happy blogging. */
- Add the following code just above it:
define('WP_MEMORY_LIMIT', '256M');
- Save the file and refresh your site.
NOTE: This depends on your web host. They may impose caps on memory, and you can ration how much memory you use. If the above solution does not fix the WordPress memory exhaustion error, you must contact your web host or try the below solutions.
4. Modify the php.ini File
If the wp-config.php edit doesn’t solve the problem, try changing the php.ini file. This file manages how PHP runs on your server.
- Log in to your cPanel and scroll to Files → File Manager.
- Go to the public_html folder. Look for a file labeled as php.ini or php5.ini. If that does not exist, create a new text file and name it php.ini.
- How do you make a new text file? Through using a simple text editor called Notepad.
- Update or add this line to the editor, save, and upload/update.
memory_limit = 256M
- Save the file and refresh your site.
Tip: This method works well for fixing the Cpanel WordPress memory exhausted error.
5. Edit Your .htaccess File
The .htaccess file is another place to increase the memory limit:
- Go to cPanel → File Manager and find your public_html
- Locate the .htaccess. If you can’t find it, enable “Show Hidden Files.”
- Add the below code at the last:
php_value memory_limit 256M
- Save your changes and test your site.
Pro Tip: Be cautious when editing this file, as it affects how your server handles requests.
6. Upgrade Your Hosting Plan
If you’ve tried everything and still see the fatal error WordPress memory exhausted message, your current hosting plan might not provide enough resources.
- Shared hosting plans often have strict limits.
- Converting to a VPS or personal dedicated server can also give you more memory and better performance.
7. Turn Off Unused Themes and Plugins
Still, looking for solutions on how to fix WordPress memory exhausting errors? I’ve got your back. Too many plugins and themes drain your RAM, so I recommend deactivating the plugins you don’t use or need.
- Find Plugins, hover on it, and go to Installed Plugins.
- Reduce resource utilization and use a lightweight theme, such as Astra or GeneratePress.
8. Make Your Pictures Better (Optimize Them)
- Your RAM may become overloaded by large image files:
- Compress your image using the Smush or EWWW Image Optimiser plug-ins; these plug-ins minimize file size and compress image files without sacrificing quality.
9. Enable Caching
Caching helps reduce memory(data) usage by storing parts of your website for faster access:
- Use plugins like W3 Total Cache or WP Super Cache.
- Configure them to cache content and minimize the load on your server.
10. Limit Background Tasks
Tasks like backups, updates, and cron jobs can take up memory:
- Schedule backups during low-traffic hours.
- Limit how often automatic updates run.
11. Check for Plugin or Theme Conflicts
WordPress plugins or theme conflict can lead to memory errors:
- To resolve the issues, deactivate all the plugins temporarily.
- Reactivate plugins one by one to find the problematic ones.
- Switch to a default theme like Twenty Twenty-five to see if your theme is causing issues.
12. Update PHP Version
Older PHP versions can be inefficient and use more memory.
- Go to cPanel → Software → MultiPHP Manager.
- Update your site to the latest stable version, such as PHP 8.2 or 8.3.
Newer PHP versions handle resources more efficiently, reducing memory issues and solving the WordPress memory-exhausted error.
13. Reduce Active Users and Bots
High traffic from users and bots can overload your server, especially on shared hosting.
- Use a security plugin like Wordfence to limit unwanted bots.
- Monitor traffic spikes using Google Analytics(GA 4) to manage high load times.
14. Contact Your Hosting Provider
If you’re seeing the exhausted memory error in PHP 5.6 WordPress despite making these changes, it’s time to reach out for help:
- Your hosting provider can tell you if they have a cap on memory limits.
- They may also be able to make adjustments for you.
- If you are unsatisfied, look for WordPress experts; they’ll surely do this job for you.
Final Thoughts
Fixing the WordPress memory exhaustion error might seem tricky, but it’s manageable. Start with simple fixes like editing the wp-config.php file or enabling the cache. If that doesn’t work, move to more advanced methods like updating the php.ini or .htaccess files.
Remember, if these steps don’t fix the WordPress memory exhausted error, upgrading your hosting or contacting support is the best move. Always keep a backup of your site before making changes to avoid any unexpected problems.
With these methods, your WordPress site should be running smoothly in no time! Don’t forget to share this guide with other WordPress users who might need help.