In this article, I will discuss, how you can increase the PHP memory limit. You can do it in few simple steps. There are multiple ways to change the memory limit but here I will discuss only one method.
WordPress is a very popular and most preferred content management system. To run every website on WordPress, you need to have a PHP memory. You use plugins, themes, images, and other content on your site. And all these require memory to run.
At some point, you may exhaust your PHP memory limit and you may face a memory limit error. It most common error in WordPress sites. And it will depend on how much memory you have and how much you have used.
If you have exhausted your memory, you may face an error. And in that case, you need to increase the PHP memory limit.
Let’s understand how you can do it.
Increase the PHP Memory Limit
First, you should know what is your current memory limit of your website. You can check it from the Cpanel and as well as Site Health also.
As I above said that there are multiple ways to increase the PHP memory limit of your website. However, here I will discus, how you can change it through wp-config.php. You can do it in the following steps.
- First of all, you log in to your Cpanel.
- Open the File Manager.
- Do double click on the Public.html file.
- Select wp-config.php file by doing single click.
- Do the write click and click on edit.
- Now find a code like in the below image.
You may have another number instead of 256M. Now you can set the figure as per your choice. However, you can do it up to the maximum memory limit allocated to you by your host.
Increase the PHP memory limit in the wp-config.php file and save your file. If your site is brand new, you might not have the same code in your file. So in that case, you can add the above code.
But before you start the process to change the limit, you should always take the backup of your site. So, In case, something goes wrong, you can restore your site.
In this way, you can increase your PHP memory limit in your WordPress site. In case, this method doesn’t work for you, you may try another suitable method for you. But in case you face this error after that also, you should contact your host provider.