If you are seeing an allowed memory size exhausted error in WordPress? This is one of the most common WordPress errors, and you can easily fix it by increasing the php memory limit in WordPress. In this article, we will show you how to fix WordPress memory exhausted error by increasing PHP memory.

What is WordPress Memory Exhausted Error?

WordPress is written in PHP server-side programming language. Every website needs a WordPress 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.

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

The error can occur in a number of different circumstances. However, it’s most likely to arise when you take specific types of actions on your site, such as:

  • Installing and activating a new theme or plugin.
  • Uploading images and other media to your site.

If you’ve run into this error on your own WordPress site, don’t worry. The reasons behind it are simple – let’s talk a little more about why it occurs.

Increasing the WordPress Memory Limit

To address memory limit issues, there are two paths:

  • Adjust yourself
  • Contact your hosting company

Do It Yourself

To adjust on your own, here are some methods to try. Be aware that this section requires advanced knowledge; it is not basic.

Edit your wp-config.php file

Add this to the top, before the line that says, “Happy Blogging”:

define('WP_MEMORY_LIMIT', '256M');
WordPress memory can be different from the server – you need to set this regardless of server memory settings

http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP

Edit your PHP.ini file

If you have access to your PHP.ini file, change the line in PHP.ini
If your line shows 64M try 256M:

memory_limit = 256M ; Maximum amount of memory a script may consume (64MB)

Edit your .htaccess file

If you don’t have access to PHP.ini try adding this to an .htaccess file:

php_value memory_limit 256M

Contact Your Host

Should you not feel comfortable in trying the above methods, or the above did not work for you, you need to talk to your hosting about having them increase your memory limit.

Reference:

https://www.wpbeginner.com/wp-tutorials/fix-wordpress-memory-exhausted-error-increase-php-memory/

https://woocommerce.com/document/increasing-the-wordpress-memory-limit/

https://kinsta.com/knowledgebase/wordpress-memory-limit/