Are you facing an allowed memory size exhausted error in WordPress?
This guide will help you.
WordPress is a piece of software, which means it requires a server and memory in order to run (among other things). However, in some cases your server won't provide the platform with enough resources for it to run properly. This can result in the memory exhausted error in WordPress.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to fix WordPress related issues.
In this context, we shall look into steps to resolve WordPress memory exhausted error by increasing PHP memory.
More information about WordPress Memory Exhausted Error?
WordPress is written in PHP, which is a server-side programming language. Every website needs a great hosting server for it to function properly.
Web servers are just like any other computer. They need memory to efficiently run multiple applications at the same time. Server administrators allocate specific memory size to different applications including PHP.
So When your WordPress code requires more memory than the default allocated memory, you get to see this error:
Fatal error: 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 PHP memory limit if it is less than 64MB. However, 64MB is often not high enough.
Now, let's see how to easily increase PHP memory limit in WordPress to avoid memory exhausted error.
How to Increase PHP Memory Limit in WordPress ?
i. To begin, you need to edit the wp-config.php file on your WordPress site. It is located in your WordPress site's root folder, and you will need to use an FTP client or file manager in your web hosting control panel.
ii. Next, you need to add this code in wp-config.php file just before the line that says 'That's all, stop editing! Happy blogging.' :
define( 'WP_MEMORY_LIMIT', '256M' );
This code tells WordPress to increase the PHP memory limit to 256MB.
iii. Once you are done, you need to save your changes and upload your wp-config.php file back to your server.
You can now visit your WordPress site and memory exhausted error should disappear now.