Increase the WordPress allowed memory size

Are you 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.

By default, WordPress will attempt to increase the memory allocated to PHP to 40MB  for a single site and 64MB for multisite, so the setting in wp-config.php should reflect something higher than 40MB or 64MB depending on your setup. It is very common to exceed this limit and get the error.Fatal error: Allowed memory size The fatal error message looks similar to this one:

Fatal error: Allowed memory size of 23556632 bytes exhausted (tried to allocate 3349917 bytes) in /home/xxxxx/public_html/wp-includes/plugin.php on line xxx


Photo Courtesy: WP Beginner


To increase the WordPress allowed memory size for your website:

  1. Open wp-config.php, which by default is located in the root WordPress directory.
  2. Find the following line near the end of the file:
    /* That's all, stop editing! Happy blogging. */
    
  3. Just above that line, add the following line:

    Increase PHP Memory to 64MB

    define( 'WP_MEMORY_LIMIT', '64M' );
    

    Increase PHP Memory to 96MB

    define( 'WP_MEMORY_LIMIT', '96M' );
    

    Administration tasks require much memory than usual operation. When in the administration area, the memory can be increased or decreased from the WP_MEMORY_LIMIT by defining WP_MAX_MEMORY_LIMIT.

    define( 'WP_MAX_MEMORY_LIMIT', '256M' );
    

    Save your changes. You can now visit your WordPress site and memory exhausted error should disappear now.

    Note:
     If this solution does not work for you, then this means your web hosting service provider does not allow WordPress to increase PHP memory limit. You will need to ask your web hosting provider to increase your PHP memory limit manually. You can also visit WordPress Codex

Leave a Comment

Your email address will not be published. Required fields are marked *