How to fix Memory Exhausted Error in WordPress
Is your WordPress site displaying an allowed memory size exhausted error in WordPress? This post will discuss How you can fix Memory Exhausted Errors in WordPress.
This error occurs when you are about to exhaust your memory limit. You can fix it easily by increasing the PHP memory limit in WordPress.
We’ll explain what is Memory Exhausted Errors in WordPress and the method to fix them.
What is Memory Exhausted Error in WordPress?
WordPress is a CMS written in PHP language ( a server-side programming language). Websites need a WordPress hosting server to function properly, and Web servers need memory to run multiple applications effectively altogether.
Server administrators allot specific memory sizes to different applications, including PHP.
When your WordPress code needs more memory than the default allowed memory, you will notice this error.
Fatal error: The allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
By default, WordPress automatically tries to increase the PHP memory limit if it is less than 64MB. However, 64MB is not enough for further proper functioning.
Now, moving on to the method to easily increase the PHP memory limit in WordPress to keep away the memory exhausted error.
Increase PHP Memory Limit in WordPress
To increase the PHP memory limit, you have to edit the wp-config.php file on your site. The wp-config.php is located in your WordPress root folder, and you have to use a file manager or an FTP client in your web hosting control panel.
Then, copy and paste this code in your wp-config.php file just before the line ‘That’s all, stop editing! Happy blogging.’
define( 'WP_MEMORY_LIMIT', '256M' );
This code will tell WordPress to increase the PHP memory limit to 256MB.
You have to save your changes and then upload your wp-config.php file back to the server.
Now, look in on your WordPress site; it must fix the memory exhausted error now.
Note: If the solution does not work for you and you are still seeing the allowed memory size exhausted error, then this suggests that your web hosting service provider did not allow to increase PHP memory limit in WordPress.
You have to get in touch with your web hosting provider and ask them to increase your PHP memory limit manually.
To conclude- While working in your WordPress, if you notice the allowed memory size exhausted error, don’t worry!
You can fix the error easily by increasing the PHP memory limit. If this doesn’t work workes for you can contact your hosting provider.
We hope this write-up helped you resolve your WordPress memory exhausted error. If you are experiencing any other error on your site, you can fix it by following the steps told in our other article on what to do when you are logged out of the WordPress admin area.