Fatal error: Allowed memory size of bytes exhausted

When attempting to upgrade WordPress, you might encounter a Fatal error like we did on one of our WordPress installs when upgrading to WordPress 2.8.5. The error is typically encountered when automatically upgrading (from the dashboard) WordPress installations containing a lot of posts and or using many plugins. The Fatal error might appear as follows:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2354671 bytes) in ../public_html/wordpress/wp-includes/http.php on line 1331

Fatal Error when upgrading or updating WordPress

How to Fix the Fatal error during WordPress Upgrade

Here is how we fixed the Memory Limitation problem and got our WordPress upgraded or updated and working fine again.

  1. Using your favorite FTP client, FTP to your WordPress installation.
  2. Copy wp-config.php to your desktop.
  3. Open wp-config.php using a text editor and add the following line under the rest of the define lines in the MySQL Settings section.

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

  4. Save the file and upload it back to server overwriting the old file when prompted.
  5. Now simply login to the troubled WordPress site and proceed to upgrade.

WordPress should proceed to upgrade without the Fatal error.