Increasing the WordPress PHP memory limit could be for several reasons. Some of them are HTTP errors while uploading the image, white screen of death, and also 500 Internal server errors, fatal error: allowed memory size (memory exhausted error), and more.
By default, WordPress comes with 32MB of memory, which is quite low and needs to be increased for obvious reasons. Doing so will certainly fix memory-exhausted errors in WordPress just like magic.
We have plenty of reasons to increase WordPress PHP memory limit now, isn’t it? Let’s do it.
As we have several reasons to do so, we have several ways to do so. I will walk you through them in this tutorial.
What is the PHP memory limit?
PHP memory limits are as unique as highway speed limits. There can be an infinite number of lanes on a highway (parallel processes), just as there can be an infinite number of cars. PHP’s memory limit is the maximum amount of memory that can be allocated to one process. PHP processes are usually associated with specific page views.
Increase PHP Memory Limit through WP-Config in WordPress
It would be easier for you if you have ever edited your wp-config file before. If you haven’t this is the step-by-step guide for you. You need to access the root folders and files of your site. You can do it through the FTP server or even from your Control Panel. Here I will do it through the Control Panel.
Go to your Control Panel. It can be accessed by following a similar link below,
https://www.yourdomainname/cpanel, replace yourdomainname with your actual domain
Enter the Login credentials, After landing on the CPanel Dashboard. Look for File Manager and Click on it. You will see your site database and files over there.
To access the WP-Config file, look for “public_html” and click on that. You will find the wp-config file over there, right-click on it and Edit it.
This will open a code editor, and find the line which will look like, “That’s all, stop editing! Happy blogging“.
And paste the below code, just above it. Make sure you do the same!
define( 'WP_MEMORY_LIMIT', '256M' );
All you need to do now is to hit the Save Changes button. The above code defines WordPress to increase the memory limit to 256M, though you can increase or decrease that number. It all depends on how big your site is. But, if you don’t know what you are doing, leave it to 256M.
That’s it, doing you will get rid of the memory exhausted error. Please share your thoughts if this helps in the comment section below.