How to Fix PHP Fatal Error: Allowed Memory Size of # Bytes Exhausted

by Lorenzo Orlando Caum on March 20, 2013

In this tutorial we’ll show you how to fix a common error that can occur when WordPress runs out of resources.

By default WordPress will try to set aside 40M of memory for PHP. However, there are times where this amount is not enough.

Here are a few examples of the PHP memory error:

[20-Jan-2013 03:51:52] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 512 bytes) in /redacted/wp-content/plugins/shopp/core/flow/Order.php on line 2168
[11-Feb-2013 01:55:26] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 15552 bytes) in /redacted/wp-content/plugins/shopp/core/model/Image.php on line 29
[20-Mar-2013 05:25:29] Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 2046199 bytes) in /redacted/wp-content/plugins/shopp/core/DB.php on line 238

This error can be fixed by increasing the PHP memory that is available to WordPress. The most common method to fix this is to include a Macro for the WP_Memory_Limit within your wp-config.php file. Below are some examples:

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

Increasing the WP Memory Limit

1) Login to your WordPress site with an FTP client. We recommend Transmit (for Mac). FileZilla is a free option that is available for multiple platforms.

2) Then browse to your WordPress root or the current location of your wp-config.php file.

3) Open your wp-config.php file with an editor. Next, copy one of the Macros options mentioned earlier and then paste it towards the middle of your wp-config.php file and save changes.

Notes: Get more information on increasing memory for WordPress.

Related Posts Plugin for WordPress, Blogger...
  • Was this post helpful to you?
    Join our newsletter to receive updates!
  • Author: Lorenzo Orlando Caum

    Lorenzo Orlando Caum is the founder of Enzo12 LLC, a web engineering firm in Tampa, FL.

    Lorenzo contributes to the Shopp project as a member of the support team. He has written several WordPress extensions for Shopp.

    If you would like to know more about Lorenzo, you can follow @lorenzocaum on Twitter or check out his blog.

    • Matt H

      Thank you this worked for my site. Nice explanation

    Previous post:

    Next post: