How to Fix PHP Fatal Error

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

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 SFTP or FTP client. We recommend Transmit (for Mac). FileZilla and Cyberduck are free options that is available for multiple platforms. For those of you who are on Cpanel you can jsut login to cpanel and use the built in file editor

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.

Was this answer helpful?

 Print this Article