How to Increase PHP Memory Limit of Your WordPress Site
Are you receiving a WordPress memory exhausted error? Does the error tell you that your WordPress memory size has exhausted? It is one of the most common WordPress errors users often face. And the best thing is that you can easily fix this error by simply increasing the PHP memory limit in WordPress. As many of you may not know how to do that, we have come up with this article. Here we will discuss how to increase PHP memory limit of your WordPress site.
WordPress Memory Exhausted Error
Before we help you learn how to increase PHP memory limit of your WordPress site, let’s first discuss what WordPress memory exhausted error is. As you must know, WordPress is written in PHP, a server-side scripting language. For any WordPress site to function properly, it needs a WordPress hosting server. A web server works just like a computer does. It needs memory to run multiple applications at the same time. Specific memory size is allocated by the server admin to each of the applications including PHP.
Now let’s find out when this WordPress error appears. When your WordPress site requires more PHP memory than the allocated memory, you will get an error message saying – “Fatal error: Allowed memory size of x bytes exhausted”.
Although WordPress can automatically increase PHP memory limit if it is less than 64 MB, sometimes it is not enough. And that is why you encounter the memory exhausted error where you see a white screen with the error message. You may receive this WordPress error across your entire website or while performing certain actions like submitting a form. So you have to increase PHP memory limit manually to avoid the memory exhausted error.
How to Increase PHP Memory Limit?
Now, after discussing the memory exhausted error in detail, let’s find out how you can increase PHP memory limit. Well, it is very simple. Follow the steps given below –
- First, you need to edit the wp-config.php file of your WordPress website. And to edit this file, you need to locate it. The wp-config.php file is located in the root folder of your WordPress site.
- To edit the file, you need to use either an FTP client or the file manager in your web hosting control panel.
- In your wp-config.php file, you need to paste the following code just before the line “That’s all, stop editing! Happy blogging”.
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
- The above code will tell WordPress to increase PHP limit of your WordPress site to 256 MB.
- After making the changes to your wp-config.php file, you need to save it and upload it back to your server.
Now, when you will visit your WordPress site, the memory exhausted error will not appear again. If you have recently started using WordPress, then you might not be familiar with how to edit the wp-config.php file. Refer to this article for complete information – Editing wp-config.php. Here you will find the step-by-step method to edit the wp-config.php file.
Some users say that even after increasing the PHP memory limit, they face the memory exhausted error. This happens just because your web hosting provider does not allow WordPress to increase PHP memory limit. So if the above method does not work for you, then you should contact your web hosting provider to look into the matter.
Through this article, we tried to help you to learn more about the memory exhausted error in WordPress. When this error appears, you have to increase PHP memory limit, either by yourself or by contacting your web hosting provider. We hope the information shared in this article will be helpful for you. Please give your valuable suggestions or feedback through the comments section below.