WordPress Backup Plugin Exceeding Memory Limit β Fatal Error: Complete Fix
You click "Backup Now" in your backup plugin (UpdraftPlus, BackWPup, Duplicator, etc.). The progress bar starts. It gets 30% through the database export. Then boom: Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate X bytes). The backup fails. You go to Settings β General, increase the PHP memory limit from 256M to 512M. You try again. Same error. It's like your memory limit didn't even change. What's happening is that backup plugins are memory hogs, and throwing more RAM at the problem only works so far.
Why Backup Plugins Use So Much Memory
Reason #1: Database Compressing in RAM
When a backup plugin exports your database, it reads the entire database into memory, then compresses it into a ZIP or SQL file. If your database is 500MB, the plugin might try to load that entire 500MB into RAM before compressing. That's already at or above the memory limit on most shared hosting (256β512MB).
The culprit: Backup plugins process the entire database in one go instead of streaming it in chunks. Plugins like UpdraftPlus have improved this, but older versions and less-optimized plugins still do it the memory-intensive way.
Reason #2: Building the File List
Before backing up, the plugin scans your /wp-content/ directory and all subdirectories to list every file it needs to backup. On sites with thousands of files (or large media libraries with thousands of images), building this list in memory can exceed the limit.
Reason #3: Large wp_posts or wp_options Table
The wp_posts table stores all your posts, pages, revisions, and more. The wp_options table stores all site settings and plugin options. On sites with:
- 1000+ posts/pages
- Lots of post revisions (not deleted)
- Many plugin options or transients
These tables can bloat to 50MBβ500MB. Loading them into memory to back up is a memory killer.
Reason #4: Emailing Large Backup Files
Some plugins try to email you the backup file. Preparing an email with a 500MB attachment requires loading that file into memory first. This is where email delivery itself can failβthe plugin needs memory to process the mail attachment.
Reason #5: Plugin Overhead
The backup plugin itself, plus any other active plugins, all live in the same PHP process and share the memory limit. On a site with 20 plugins, each using 10β30MB, the backup plugin doesn't have much room left for its own work.
Root Causes: Why Raising Memory Limit Doesn't Always Work
Cause #1: PHP's Actual Memory Limit Is Lower Than You Think
WordPress allows you to set WP_MEMORY_LIMIT in wp-config.php. But that can only increase the limit up to the server's php.ini limit. If php.ini says 256M and you set WP_MEMORY_LIMIT to 512M, WordPress is capped at 256M. Setting WP_MEMORY_LIMIT to 512M when php.ini is 256M has no effect.
How to check: Go to Tools β Site Health β Info β Server and look for "Memory Limit". This is the TRUE limit.
Cause #2: Shared Hosting Has a Hard Cap
On shared hosting, your host might set a maximum memory limit of 256M for your account. No matter what you do in wp-config.php, you can't go higher. You're stuck.
Cause #3: Database Is Already Too Large
If your database is 500MB and you've set memory to 512M, the backup plugin still has to load the database into memory. But WordPress itself, other plugins, and the plugin's own code also need memory. You don't have enough headroom.
Cause #4: The Plugin Is Just Inefficient
Some backup plugins handle large databases poorly. They loop through rows and build arrays in memory instead of streaming to disk. No amount of memory increase will help because the plugin's algorithm is fundamentally broken for large sites.
Fix #1: Increase Memory Limit (The Quick Fix)
Use this first. It works for many sites. But expect it to fail if your database is 500MB+ or your hosting has a hard cap.
Option 1A: Edit wp-config.php
- Use FTP or cPanel File Manager to navigate to your site root
- Open wp-config.php in a text editor
- Find the line
define('WP_MEMORY_LIMIT', '40M');(or similar) - Change it to
define('WP_MEMORY_LIMIT', '512M');or higher - Save and close
- Try the backup again
Note: If you don't see that line, add it before the line that says /* That's all, stop editing! Happy blogging. */
Option 1B: Increase via cPanel
- Go to cPanel β Select PHP Version
- Click "Switch To PHP X.X"
- Go to "Options" tab and find "memory_limit"
- Change it to 512M or higher
- Click "Save"
If this doesn't work: Your host has a hard limit. Contact them and ask for higher memory allocation.
Verify the Change Worked
- Go to WordPress β Tools β Site Health β Info
- Look for "Memory Limit" under Server
- It should show your new limit
If it still shows the old limit, the change didn't apply. Try a different method or contact your host.
Fix #2: Optimize Your Database (Reduces What Needs Backing Up)
Use this if memory increase doesn't work. A bloated database is the #1 cause of backup failures. Cleaning it reduces the size of the backup, which reduces memory needed.
Install WP-Optimize
- Go to WordPress β Plugins β Add New
- Search for "WP-Optimize" and install it
- Activate it
- Go to WP-Optimize β Database
- Click "Run all selected optimizations"
- Wait for it to complete
What it does: Deletes old post revisions, spam comments, orphaned post meta, expired transients, and optimizes database tables. On a typical site, this can shrink the database by 20β50%.
After Optimization
- Go to your backup plugin settings
- Try the backup again
Important: Take a manual database backup first, just in case. WP-Optimize is safe, but better safe than sorry.
Fix #3: Split the Backup (Separate Database and Files)
Use this to work around the memory limit. Instead of backing up everything at once, back up the database separately from the files.
Via UpdraftPlus (Most Plugins Have This Option)
- Go to UpdraftPlus β Backup / Restore
- Click "Backup Now"
- In the "Include in backup" section, uncheck "Files"
- Leave "Database" checked
- Click "Backup Now"
- Wait for the database backup to complete
- Go back and do a second backup with only "Files" checked (no database)
By splitting it, you're giving the plugin less data to process in each pass, so it uses less memory.
Exclude Large Files from the Backup
In your backup plugin, exclude unnecessary files:
- /wp-content/cache/ (caching files)
- /wp-content/updraft/ (UpdraftPlus temporary files)
- /wp-content/uploads/backup-* (old backup files)
- Large plugin folders you don't really need to backup
Most plugins let you specify which folders to skip. This reduces the file list the plugin needs to load into memory.
Fix #4: Don't Email Large Backups
If your backup plugin offers to email you the backup file, and the file is over 50MB, don't do it. Emailing large files requires memory to attach them, and most email servers reject files over a certain size anyway.
Instead: Store backups to cloud storage (Dropbox, Google Drive, AWS S3) and download them from there.
In UpdraftPlus and most plugins:
- Settings β Backup Storages
- Choose a cloud provider (Dropbox, Google Drive, S3)
- Authenticate it
- Disable email backups (or set a limit: "only email if under 25MB")
Fix #5: Schedule Backups During Off-Peak Hours
If other plugins or your site traffic is high when you try to backup, you have less available memory. Schedule backups for 3 AM when no one is using the site.
In UpdraftPlus:
- Settings β Backup Schedules
- Choose a time (e.g., "Daily at 2 AM")
- Set the schedule
Lower traffic = lower memory usage by other plugins = more room for the backup.
Fix #6: Use an Alternative Backup Method (For Desperate Cases)
If none of the above works, use a different backup approach that doesn't rely on PHP:
Option A: Hosting Control Panel Backups
cPanel, Plesk, and other hosting panels have native backup tools that don't use WordPress PHP. They backup directly at the filesystem level and don't hit memory limits the same way.
How to use: Log into cPanel β Backups β Backup Now. This bypasses WordPress entirely.
Option B: Managed WordPress Hosting
If your current host is too limited, consider switching to managed WordPress hosting (Kinsta, WP Engine, Bluehost Pro). They handle backups for you without memory issues.
Option C: Command-Line Backups via WP-CLI
If you have SSH access:
wp db export /path/to/backup.sql
wp db export /path/to/backup-$(date +%Y-%m-%d).sql
WP-CLI handles memory more efficiently than backup plugins and doesn't hit limits as fast.
Complete Troubleshooting Checklist
| Step | What to Check | Fix If Broken |
|---|---|---|
| 1. Check actual memory limit | Tools β Site Health β Server | Increase to 512M or higher (Fix #1) |
| 2. Check database size | phpMyAdmin or backup plugin report | Optimize database with WP-Optimize (Fix #2) |
| 3. Split backup into parts | Backup plugin settings | Backup database and files separately (Fix #3) |
| 4. Exclude large/unnecessary files | Backup plugin settings | Uncheck cache, temp files, uploads/backup-* (Fix #3) |
| 5. Disable email delivery of large files | Backup plugin settings | Use cloud storage instead (Fix #4) |
| 6. Schedule backup for off-peak time | Backup plugin settings | Set backup to run at 2 AM (Fix #5) |
| 7. Still failing? Use hosting backup tool | cPanel β Backups | Use native backup tool (Fix #6) |
Prevent Memory Issues in the Future
1. Keep your database clean: Run WP-Optimize monthly to delete revisions, spam, and orphaned data. A smaller database = easier to backup.
2. Monitor backup file sizes: If your backup is growing beyond 500MB, it's time to optimize or upgrade your hosting.
3. Limit post revisions: Add this to wp-config.php to prevent post revisions from bloating the database:
define( 'WP_POST_REVISIONS', 3 );
This keeps only the last 3 revisions per post instead of storing every single change.
4. Store backups in the cloud: Dropbox, Google Drive, and AWS S3 are more reliable and don't require your server to process the backup file.
5. Use scheduled backups: Schedule them for 2β3 AM when no visitors are using your site. Lower traffic = lower memory usage overall.
The Real Talk
Backup plugins are not inherently brokenβthey just have a tough job. They need to read your entire database into memory, compress it, and write it to disk. On a site with a 500MB database and only 256MB of available memory, something has to give. The fixes above all work by either giving the plugin more memory to work with, or reducing the amount of data it needs to backup. Usually, a combination works best: increase memory a bit, optimize the database, and split the backups.
The real takeaway: don't wait until your site is 2GB and your memory is maxed out. Start optimizing early, keep your database trim, and schedule backups before they become a crisis.
Last updated: October 2026. Real data: WordPress.org support forums (2009β2026), UpdraftPlus documentation, WP Staging documentation, noc.org support, CyberOptik error documentation.
