# Fatal error: Allowed memory size of bytes exhausted

Canonical URL: https://lancelhoff.com/fatal-error-allowed-memory-size-of-33554432-bytes-exhausted/
Published: 2009-10-21
Last modified: 2009-10-21
Description: Troubleshoot the WordPress “Allowed memory size exhausted” fatal error during upgrades and learn which PHP memory settings to check with your host.

---

Fixing the "Allowed Memory Size Exhausted" Fatal Error When Upgrading WordPress: When attempting to upgrade WordPress, you might encounter a **Fatal error** like we did on one of our WordPress installs. This usually happens during automatic upgrades (via the dashboard) on sites with many posts, heavy plugins, or large themes. The error typically appears as:

> 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](https://lancelhoff.com/wp-content/uploads/2009/10/Fatal-error-Upgrading-WP-600x187.webp)

## Why This Fatal Error Occurs

This error occurs because your WordPress site has reached the PHP memory limit set by your server configuration. Upgrades, large plugins, or complex themes can require more memory than the default allowance, causing WordPress to fail mid-upgrade.

## How to Fix the Memory Exhausted Fatal Error

Follow these steps to increase the PHP memory limit and complete your WordPress upgrade safely:

1. Using your favorite **FTP client**, connect to your WordPress installation.
2. Download the **wp-config.php** file to your desktop for editing.
3. Open **wp-config.php** in a text editor and add the following line under the MySQL settings or above the "That's all, stop editing" comment:
 `define('WP_MEMORY_LIMIT', '128M');`

*Note:* You can increase to 256M or higher if your site is very large, but confirm with your host first.
4. Save the file and upload it back to your server, overwriting the old wp-config.php file.
5. Return to your WordPress dashboard and retry the upgrade.

## Alternative Methods to Increase PHP Memory Limit

If the wp-config.php method does not work, you can try the following options:

- **php.ini**: Add or edit the line `memory_limit = 128M` in your site's php.ini file.
- **.htaccess**: Add `php_value memory_limit 128M` to your .htaccess file if allowed by your hosting.
- **Contact Your Host:** Some shared hosts restrict PHP memory settings. Ask your hosting provider to increase your memory limit temporarily.

## Tips to Avoid Memory Issues During WordPress Upgrades

- Deactivate unnecessary plugins before upgrading.
- Switch to a default theme temporarily if using a heavy or custom theme.
- Backup your site (files and database) before performing upgrades.
- Upgrade plugins and themes individually if large upgrades fail.

## Summary

By increasing the PHP memory limit in wp-config.php or through your server configuration, WordPress upgrades should complete without the fatal memory exhausted error. Always backup your site before performing upgrades and consider deactivating large plugins temporarily for smoother updates.
