The WordPress memory exhausted error is one of the most common WordPress errors. One way to fix this issue is to increase the PHP memory limit in WordPress. This article is completely focused on solving the WordPress memory exhausted error by increasing the limit of the PHP memory.
Understanding the Basics:
- PHP can be understood as a server-side programming language.
- WordPress is written in PHP.
- For the efficient working of a website, it requires a WordPress hosting server.
- Because we run numerous applications at the same time, Web Servers needs sufficient memory to function properly.
- For separate applications, specific memory sizes are allocated by the Server Administrators.
- Server Administrators also allocate memory to PHP.
- If you can see the WordPress memory exhausted error, it simply means that more memory is demanded by the WordPress code than what is allocated by default.
- If the memory limit of PHP is less than 64MB, WordPress tries to increase this limit automatically.
- However, even if increased to 64MB, the memory limit might still be lacking.
If the memory is exhausted, you might see something like this.
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
Increasing the PHP Memory Limit in WordPress:
To increase the limit of PHP Memory, you can follow the below steps:
- Go to your WordPress site’s root folder.
- Use an FTP client or file manager in your web hosting control panel to edit the wp-config.php file.
- Open the wp-config.php file.
- Add the below code before the line ‘That’s all, stop editing! Happy blogging.’
define( 'WP_MEMORY_LIMIT', '256M' );
- Save the file.
- Upload the wp-config.php file back to the server.
- The memory exhausted error must be fixed now since we have now increased the PHP memory limit to 256MB.
Ask your Web Hosting Provider:
If the above solution fails to solve the problem, then you might need to contact your web hosting provider. They will then increase the limit of PHP memory, manually.