If you are not habituate of handling WordPress Errors like Memory exhausted error, 500 Internal Server Error, 404 Error etc then get ready. Being a WordPress user you do have to tackle and pamper it, just like you do it for your girlfriend.
Haha, jokes apart, I know you are frustrated right now, don’t worry by the end of the article you will fix the issue!
A flexible Content Management System like WordPress takes care of a lot of aspects of your website. In such scenario, at times it throws up few of the WordPress errors like “Memory exhausted” for your website.
And that could put in the panic to any new WordPress users. But, it’s very fortunate that he fixes are pretty much simple, even if you are not into the too much into the techie side.
Yeah, I really mean, it doesn’t matter at all. Here in this article, we are going to see how to fix memory exhausted error in WordPress, just in a few quick steps only.
Fix Memory Exhausted Error
Fix Memory Exhausted Error in WordPress: Method 1
Follow the below few simple steps to get rid of that error to see your awesome WordPress website live back again.
- Login to your CPanel, to access the files of your website.
To do so, follow the link provided by the hosting provider, or just type yourdomainname/cpanel/
- Once you could access the Cpanel Dashboard after logging in, Scroll Down to find “File Manager”
Here, you need to access and modify the file named as “wp-config” and to do so,
- Click on the public_html, there you would be able to see all the website files along with the wp-config file,
Note: wp-config file contains, a lot of sensitive information so you can take your website backup, just being on the safe side, if anything goes wrong mistakenly.
- Select and right-click on the wp-config file, and select Code Edit, to edit the file.
This will open an Editor with a lot of information on your website. Now, be very cautious here and scroll down to find a line which says “That’s all, stop editing! Happy blogging“.
And once you find it, go ahead and paste the below single line of code, just below it.
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
Note: For, being sure what you should do exactly you can refer to the below image, it should look alike the same
- And finally, hit Save Changes Button.
This will increase the WordPress memory to 256mb, which is quite decent and ideal and WordPress could be able to handle all the files swiftly and smoothly doing so. Make sure not to increase the number too much, as it could crash the server.
Note: By default, WordPress comes with the 32mb memory, which needs to be changed for any website sooner or later as the website grows. It completely relies on how the website size.
You can now check your website would be live now without throwing any error.
Alternatively, you can also do the same by modifying php.ini file to get the same result.
How To Fix Memory Exhausted Error in WordPress: Method 2
This is the other method of increasing the PHP Memory Limit to get off from the error.
- Once you could access the files, navigate to public_html or wp-admin, look for a file named as php.ini or php5.ini.
If this is the first time your WordPress files are getting edited, in that case, it’s possible you won’t be able to find any of those. In such scenario, you need to create one.
All you have to do is creating a file naming php.ini
- Take a notepad locally in your Machine, enter the below code in it.
memory_limit = 512M
- And save the file named as php.ini and upload the same public_html or wp-admin folder.
And you are done and will get rid of the error.
Note: The number mentioned in the memory limit as 512mb can be increased or decrease depending on the overall website site. You can also start with 256 MB, to see if the error gets fixed, if not go ahead and increase.
Both the above methods work great and solved the issue and fix the fatal error: memory exhausted completely. Though, I would recommend trying the wp_config method first.
Do share us which one worked for you in the comment section below.