October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Fix WordPress Migration “Allowed Memory Size Exhausted” Errors

A practical, evidence-led guide to WordPress migration memory errors: capture the fatal, raise the effective PHP limit, handle execution time, filter oversized packages, and diagnose the code path that still exhausts memory.
Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A WordPress migration fails with Allowed memory size exhausted when the PHP process reaches its configured memory_limit while WordPress or the migration workload is requesting more RAM. Fix it in order: record the complete fatal error, raise WordPress and server memory limits where your host permits, increase the execution time for long imports, reduce an oversized package, and then isolate the plugin, theme, or import step that creates the peak. A larger limit is a useful remedy, but it is not a guarantee and should not replace diagnosis when the failure continues.

What the error means

PHP enforces a per-process memory ceiling. During a migration, the process may need to unpack an archive, read database data, rebuild serialized values, copy media, and run plugin or theme code. If the combined allocation reaches PHP’s memory_limit, PHP stops the request and WordPress reports a fatal error similar to:

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate ... bytes) in /path/to/file.php on line ...

The exact message matters. It tells you the limit in bytes, the additional allocation PHP attempted, and the file and line where the process finally failed. That file is not always the original cause: it can be the last operation that requested memory after an earlier plugin or import stage had already consumed most of the allowance.

Why migrations trigger the limit

  • A full archive can contain a large database and a large uploads directory that must be processed in one request.
  • Import code may temporarily hold compressed data, extracted data, database statements, and object data at the same time.
  • A plugin or theme can run initialization or indexing code while the migration is being restored.
  • The browser request can run long enough to hit a time limit even after there is sufficient memory.

There is no single memory value that guarantees every migration. The required amount depends on the archive, the import method, the site’s code, and the server’s policy.

First response: capture the complete failure

  1. Copy the complete fatal message, including the “Allowed memory size” numbers, PHP file path, and line number. Do not rely on a shortened message in the browser.
  2. Check the hosting control panel’s PHP error log and the server or PHP-FPM log for the same timestamp. A log entry can show whether the request was an import, an AJAX worker, or a command-line process.
  3. Record which migration step failed: upload, archive extraction, database import, media copy, or a post-restore operation such as cache or index rebuilding.
  4. Note the PHP version, the active server memory_limit, and whether the failure occurs consistently at the same file or percentage. These details determine whether to change configuration or reduce the workload first.

Keep the original backup and a copy of the current configuration before changing limits. That gives you a recovery point if a partially restored site needs to be removed and restored again.

Set WordPress’s memory constants correctly

WordPress exposes separate constants for normal requests and administration tasks. Add them in wp-config.php before the line that loads wp-settings.php:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

These are example starting values, not universal requirements. The first constant is intended for ordinary WordPress requests; the second is used for administration work, where imports and other back-office operations can need more memory. Put the definitions above the require_once statement that loads wp-settings.php, and do not add a second, conflicting definition elsewhere in the file.

How the documented defaults compare

WordPress setting Documented default What it covers
WP_MEMORY_LIMIT 40 MB for a normal single-site installation Typical front-end and ordinary WordPress requests
WP_MEMORY_LIMIT 64 MB for multisite Typical requests in a multisite installation
WP_MAX_MEMORY_LIMIT 256 MB for administration tasks Back-end operations, including resource-intensive work

These figures are the current values documented by WordPress.org for its wp-config.php guidance. They describe defaults, not a promise that a particular migration will complete at those values.

Why editing wp-config.php may appear to do nothing

WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT are WordPress requests for a PHP memory setting. The effective ceiling is still controlled by the PHP runtime and server. Some hosts do not allow PHP memory to be raised from application code, so a constant in wp-config.php cannot override that policy. If the effective value remains unchanged, use the hosting panel or php.ini where available, or ask the host to raise it.

Verify the effective PHP limit instead of assuming it changed

After editing the file, check the value that the failing process actually receives. Look in the hosting panel’s PHP settings, the applicable php.ini, or WordPress’s Site Health diagnostics. Confirm the value for the same PHP SAPI used by the migration: a web request and a command-line process can use different configuration files.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • If the value is still the old number, the host may block runtime changes, the edited file may not be the site’s active wp-config.php, or another configuration layer may be taking precedence.
  • If the value is higher but the fatal message reports the old limit, the import may be running in a different PHP process, such as a worker, scheduled task, or command-line binary.
  • If the value is higher and the fatal message reports the new limit, the change worked; the workload is simply still larger than the available allowance.

Ask hosting support to confirm the server-level memory_limit and the maximum value they permit. WordPress’s hosting documentation notes that whether a request to raise the limit succeeds is up to the server.

Deal with timeouts as well as memory

A migration that appears to stall can be hitting max_execution_time rather than memory_limit. Increasing memory will not make a request run indefinitely. If logs show a timeout, ask the host to raise the PHP execution time or use a server-side restore method that is not dependent on a browser connection.

Use WP-CLI for a supported server-side restore

When the migration tool provides a WP-CLI command, run the restore on the server instead of keeping a browser request open. All-in-One WP Migration documents this form for a .wpress backup:

wp ai1wm restore backup.wpress

Run the command from the WordPress installation directory, use the same site and backup you would use in the web interface, and follow the tool’s own prompts or prerequisites. A command-line restore still needs enough PHP memory and disk space; it mainly removes the browser’s connection and request-duration constraints.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reduce the migration workload when the archive is too large

If the effective limit is genuinely higher and the process still exhausts memory, reduce the peak workload. Make a complete backup before filtering anything, and preserve the excluded files so they can be copied separately after the core site is working.

Exclude nonessential large files

Many migration tools let you exclude selected directories or file types. Duplicator documents filtering large, nonessential files as a way to reduce resource use. Typical candidates are old backup archives, cache directories, generated thumbnails that can be rebuilt, and unused staging artifacts. Do not exclude the active database, the current theme, required plugins, or uploads that the site actually needs unless you have a separate restoration plan.

Split the work only when the tool supports it

Some tools can separate database restoration from media or let you transfer files independently. Use the tool’s documented workflow rather than manually editing an archive: changing package contents without updating its manifest can produce a restore that completes but leaves missing paths or inconsistent database references.

Check disk space before retrying

Extraction can require room for the compressed archive and the expanded copy at the same time. A memory fix cannot resolve a disk-full condition. Confirm available space in the destination and temporary directories, and remove only disposable files after preserving the backup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Find the plugin, theme, or import stage creating the peak

When a real increase in the effective limit does not help, treat the failure as a workload or compatibility problem rather than endlessly increasing a number. WordPress warns that simply raising limits can hide the underlying issue.

Use the fatal file and stage as clues

  • A failure while loading a plugin file points to plugin initialization or a plugin-specific migration hook.
  • A failure in the active theme or a theme dependency points to theme code running during bootstrap.
  • A failure during database import or archive extraction points first to package size, temporary memory, or the migration tool’s processing mode.
  • A failure after the database is restored, while caches or indexes are rebuilt, points to a post-restore task rather than the archive itself.

Disable nonessential extensions before the migration when the tool’s recovery procedure allows it, then re-enable them one at a time after the site is stable. If the migration tool has a safe or minimal mode, use that mode and compare the step at which the process succeeds or fails.

Reproduce with a smaller controlled workload

  1. Restore the database and essential code without optional media or generated files, if the tool supports that split.
  2. Retry the same operation with one suspected plugin or theme disabled.
  3. Compare the memory limit and the failing file in each run.
  4. Reintroduce components in small groups until the peak returns.

This approach distinguishes a package that is simply too large from code that allocates unexpectedly during migration. Keep notes for each run so you do not mistake a different import stage for a fix.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the remedy that matches the failure

Observed problem Best first remedy What to verify next
The fatal message reports a low memory limit Set the WordPress constants and raise the server-level PHP limit where permitted Confirm the effective value in Site Health, php.ini, or the hosting panel
The constant changed but the reported limit did not Contact the host or edit the active server configuration Check whether the import uses a different PHP SAPI or worker
The import stops after running for a long time Address max_execution_time or use a server-side restore Inspect timeout logs and the tool’s WP-CLI procedure
A very large package fails during extraction Filter nonessential large files or use a supported split-transfer workflow Check temporary and destination disk space
A higher limit still fails at the same plugin or theme file Disable and isolate the component or import hook Restore with minimal extensions, then re-enable methodically

A complete recovery sequence

  1. Preserve evidence. Save the fatal message, logs, backup archive, and current configuration.
  2. Identify the process. Determine whether the failure came from a browser request, a worker, or WP-CLI.
  3. Set WordPress’s requested limits. Add WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT before the wp-settings.php load line, using values appropriate for the site and host.
  4. Raise the server limit if allowed. Apply the change in the hosting panel or php.ini, or request it from hosting support.
  5. Verify the effective value. Check the runtime used by the migration, not only the file you edited.
  6. Address duration. Increase max_execution_time where the host permits it, or switch to the documented WP-CLI/server-side restore.
  7. Reduce the package. Exclude nonessential large files using the migration tool’s filter and ensure there is enough temporary disk space.
  8. Isolate code. Retry with optional plugins and themes disabled when the tool’s recovery process permits it; use the fatal file and import stage to choose what to test.
  9. Retest from a clean point. If the site is partially restored, start from a known-good backup or clean destination rather than layering repeated failed imports.
  10. Tune after success. Revert temporary configuration changes or document the final limits, then re-enable components one at a time and monitor logs.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common mistakes and their fixes

Putting the constants after the settings loader

If the definitions are added after the line that loads wp-settings.php, WordPress may already have initialized with the previous values. Move them above that line and remove duplicate definitions.

Changing only WP_MEMORY_LIMIT for an administration import

Administration operations can use WP_MAX_MEMORY_LIMIT. Set the appropriate constant as well, then verify the server’s actual ceiling.

Assuming a larger WordPress value overrides the host

It does not when the host blocks runtime changes. Confirm the PHP setting in the hosting layer and request a change from support.

Retrying a browser import indefinitely

A browser connection can fail because of execution time even when memory is adequate. Use the migration tool’s supported command-line restore or another server-side method.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Raising memory without investigating a repeatable code path

If every run fails at the same plugin, theme, or post-restore task, isolate that component. More memory can postpone the fatal while leaving the underlying allocation problem intact.

Filtering files without a separate copy

Excluding files can make a package restorable but incomplete. Keep the original archive and a clear list of excluded paths, then copy or regenerate them after the essential restore succeeds.

When to involve hosting support or a specialist

Contact the host when the control panel does not expose memory_limit, the value refuses to change, the import runs under a separate worker, or you need a higher max_execution_time. Include the exact fatal message, timestamp, domain, PHP version, requested and effective limits, archive size, and the step that failed. Ask specifically which server policy is enforcing the ceiling.

A WordPress migration troubleshooting service or managed WordPress hosting with migration support can be appropriate when you cannot access PHP logs, the source is already partially migrated, or the site must remain available during a staged restore. Give the technician the same evidence rather than only reporting that “the migration stopped.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

After the migration succeeds

  • Confirm the front end, administration area, media library, permalinks, scheduled tasks, and forms.
  • Review PHP and WordPress logs for new memory or timeout warnings during normal traffic.
  • Remove temporary archives and extracted copies only after verifying the backup and the restored site.
  • Re-enable disabled plugins and themes in a controlled order, checking logs after each group.
  • Keep the final memory settings documented and revert one-time increases that the site no longer needs.

The durable fix is the smallest configuration and workload combination that completes the migration reliably while leaving the cause understandable and recoverable.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.