Fix a crashing WordPress site in this order: capture the exact fatal error, identify whether PHP or a WordPress request is exhausting memory, then increase the correct limit only enough to reproduce the failure and isolate the code responsible. Adding a constant to wp-config.php helps only when the hosting environment allows runtime changes; the server’s PHP memory_limit remains the effective ceiling.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
The practical targets are usually 128M for a minimal installation, 256M as a sensible default, and 512M or more for demanding WooCommerce, page-builder, multilingual, or import/export workloads. Those are starting points, not guarantees. A plugin, theme, incompatible PHP version, corrupted file, cron task, or inefficient import can still crash a site under a higher limit.
As an Amazon Associate I earn from qualifying purchases.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 111. Capture the failure before changing memory
Do not begin by repeatedly raising limits. First preserve the evidence that identifies the failing request and component. Look for one of these symptoms:
Allowed memory size exhaustedfollowed by two byte counts and a PHP file path.- A WordPress page stating There has been a critical error on this website.
- A blank or partially rendered white screen.
- An HTTP 500 response, often affecting only one action such as publishing, uploading, importing, or opening an administration screen.
Check the recovery email and logs
When WordPress detects a fatal PHP error during a normal page request, it can send the site administrator a recovery-mode email. The message normally identifies the extension or theme and includes a link to enter Recovery Mode. Also inspect the web server and PHP-FPM or PHP handler logs; your host may need to provide them on shared hosting.
#1 Best Overall
WordPress can write application-level errors to wp-content/debug.log. Enable logging temporarily in wp-config.php, above the line that loads wp-settings.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Reproduce the crash once, record the timestamp, request, file path, plugin or theme name, and memory figures, then turn debugging off or remove the temporary settings. Keep display errors disabled on a public site so visitors do not see paths, credentials, or other diagnostic details.
Interpret the error path
A path inside a plugin or theme is a strong lead, not automatic proof. The component may be the place where PHP finally ran out of memory while another extension created the oversized data set. Compare the failing path with the action that triggered it, and check whether the problem occurs on the front end, in wp-admin, during an upload, or in a scheduled task.
2. Understand the three memory limits
WordPress memory errors are easier to fix when each layer is separated. PHP has a server-level ceiling called memory_limit. WordPress then asks PHP for per-request amounts using two constants. PHP’s ceiling wins: a WordPress constant cannot exceed a locked server value.
| Layer | Scope | What controls it | What a change can and cannot do |
|---|---|---|---|
PHP memory_limit |
Every PHP request handled by that PHP configuration | php.ini, a permitted per-site override, or the hosting provider |
Sets the effective ceiling. A host can prevent runtime increases. |
WP_MEMORY_LIMIT |
Typical front-end and public requests | wp-config.php |
Requests a limit from PHP when the environment permits it; it does not override a lower locked ceiling. |
WP_MAX_MEMORY_LIMIT |
Administration and other back-end requests | wp-config.php |
Requests extra headroom for editor screens, updates, media processing, and similar admin work; it is still bounded by PHP. |
| CLI PHP configuration | WP-CLI commands and shell scripts | The PHP binary, its loaded php.ini, additional .ini files, and command-line overrides |
Can differ from web PHP, so a command may fail even when browser requests work, or vice versa. |
WordPress can ask PHP for more memory at runtime with ini_set(). That request succeeds only if the host permits it and the requested amount does not exceed the server policy.
3. Set WordPress’s constants safely
Back up and edit the right file
Make a file backup before editing configuration. Use your host’s file manager, SFTP, or SSH to open the wp-config.php file in the WordPress installation directory. Do not place the definitions in a theme’s functions.php file or after the WordPress bootstrap has already loaded.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Use the correct placement and syntax
Add the definitions immediately before the line that says WordPress is asked to stop editing and loads wp-settings.php. A typical placement is:
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
/* That's all, stop editing! Happy publishing. */
If your workload needs more headroom and your host allows it, use a higher pair such as 256M and 512M. Keep the values appropriate to the actual server cap; setting an arbitrarily large number can hide a runaway process and does not create physical RAM.
Verify instead of assuming
After saving, repeat the action that failed and check the new log entry. A successful request does not prove the underlying issue is gone; it may simply mean the request received more headroom. Check the effective values reported by the hosting control panel, Site Health information, a temporary protected diagnostic page, or your host’s support team. Remove any diagnostic page immediately after use.
4. When wp-config.php changes do nothing
If the error still reports the old limit, the server is probably enforcing a lower value or the request is using a different PHP configuration.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #3
Identify the web PHP configuration
- Ask the host which PHP version and handler serve the affected domain, and which
php.inior per-site override is active. - Check whether a permitted
.user.ini, virtual-host setting, or control-panel PHP editor contains a lowermemory_limit. - Confirm that you edited the
wp-config.phpbelonging to the failing site, not a staging copy or another document root. - If PHP-FPM or another persistent handler is used, ask whether it must be restarted after a configuration change.
On shared hosting, customers commonly cannot change the global limit. Send support the exact error, timestamp, domain, PHP version, and requested workload. The provider may need to raise memory_limit, inspect server logs, or move the site to a plan with an appropriate process limit. Do not claim that a constant can bypass a locked php.ini; it cannot.
Check for configuration precedence
PHP can load a main configuration file plus additional .ini files. A later file or pool setting may override what you changed. The host can confirm the final value and the file that supplied it. If you control the server, inspect the loaded configuration and restart the relevant PHP service only after validating the syntax.
5. Treat a higher limit as a diagnostic, not a cure
Raising memory may allow one request to finish while leaving the expensive operation untouched. Re-run the failing action with logging enabled and compare the file path, request type, and memory usage. The goal is to find the operation that allocates excessive data, loops indefinitely, or is incompatible with the current PHP version.
Plugin and theme isolation
- Take a current backup and note which plugins and theme were active.
- Use Recovery Mode if WordPress supplied a recovery link. It pauses the suspected extension for your administrator session so you can reach the dashboard without disabling it for every visitor.
- Deactivate the named plugin or switch temporarily to a bundled, default theme, then repeat the original action.
- If the crash stops, update the component, check its PHP and WordPress compatibility, reduce the size of the operation, or contact its developer with the log.
- If it continues, re-enable the isolated component and test the next suspect. Avoid disabling everything permanently without recording each result.
Recovery Mode is temporary and applies to regular page loads. It does not intercept failures in WP-Cron, command-line jobs, queues, or other background tasks, so those require separate logs and isolation.
Free tools Windows power users keep installed
One-click scans. No signup required.
Other causes to investigate
- Media processing: very large images, video thumbnails, or batch optimizations can consume substantial memory per request.
- Imports and exports: loading a large file into one PHP request may exceed the limit; split the file or process smaller batches.
- Page builders and multilingual plugins: editor requests can build large object graphs, making the admin limit more relevant.
- WooCommerce: product, order, reporting, and extension tasks can require more memory than a basic site.
- Incompatible PHP: an extension written for an older PHP release can fail or use memory inefficiently after a PHP change.
- Corrupted files: a damaged core or extension file can produce a fatal error that looks like a resource problem. Reinstall verified files after securing a backup.
- Scheduled jobs: a cron task may fail without any visitor seeing an error. Match timestamps in cron, PHP, and WordPress logs.
6. Use Recovery Mode without mistaking it for a permanent fix
WordPress automatically activates Recovery Mode when it detects a fatal PHP error during a regular page load, rather than through CRON or a background task. The recovery email contains a time-limited link. Open it in the same browser where you administer the site, inspect the reported plugin or theme, and deactivate or change that component. Then update or replace it and test a normal private browsing session.
Rank #4
Because Recovery Mode changes behavior only for your recovery session, visitors may still encounter the fatal error until the offending code is fixed or disabled globally. If no email arrives, use the host’s log access, WP-CLI, or a manual plugin isolation procedure. A missing recovery email does not mean the server has enough memory.
7. Diagnose WP-CLI separately
WP-CLI may invoke a different PHP binary, php.ini, extensions directory, or set of additional configuration files than the web server. Always test the command-line environment directly.
- Run
wp --infoto identify the PHP binary and WP-CLI environment. - Run
php -i | grep memory_limitto see the CLI value, andphp --inito list the loaded configuration and additional.inifiles. - For a single trusted operation, apply a temporary override such as
php -d memory_limit=512M /path/to/wp plugin list. Replace the path and command with your actual operation. - If the command still fails, use
--skip-pluginsand, when appropriate,--skip-themesto determine whether extension code is responsible. Then test the suspect component directly. - For a lasting CLI change, edit the correct CLI configuration and restart nothing unless your PHP installation requires it; web PHP and CLI PHP may need separate changes.
A one-command override affects only that process. It does not raise the limit for browser requests, PHP-FPM workers, cron launched by another PHP binary, or server-side queues.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
8. Choose a starting memory target by workload
| Starting target | Appropriate first use | What it does not guarantee |
|---|---|---|
128M |
Minimum starting point for a vanilla WordPress installation | It may be insufficient once several plugins, a custom theme, or media processing is added. |
256M |
Recommended default starting point for many ordinary sites, especially administration tasks | It does not make inefficient code, oversized imports, or incompatible extensions safe. |
512M or more |
Demanding WooCommerce stores, page builders, multilingual sites, and import/export workloads | The workload may still exhaust memory, hit execution-time limits, or overload the server through concurrency. |
These figures are WordPress Hosting Handbook starting guidance, not capacity guarantees or benchmark results. The correct value depends on the PHP version, enabled extensions, available physical memory, concurrent requests, and the code running in the failing request.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.9. Compare the available fixes
| Intervention | Scope | Authority required | Reversibility and diagnostic value | Root-cause impact |
|---|---|---|---|---|
Temporary WP_MEMORY_LIMIT change |
Front-end requests | Edit wp-config.php |
Easy to undo; useful for reproducing a front-end failure | Adds headroom only |
Temporary WP_MAX_MEMORY_LIMIT change |
Dashboard and admin operations | Edit wp-config.php |
Easy to undo; useful for editor, update, and media tests | Adds headroom only |
PHP memory_limit change |
All web requests using that PHP pool | Server, control-panel, or host access | Reversible, but can affect every site or worker on the pool | Removes a ceiling; does not repair expensive code |
| Recovery Mode and component deactivation | Regular page loads and one administrator session | Recovery email or administrator access | Highly reversible and strong for isolating a plugin or theme | Can identify the root cause; does not cover cron or background tasks |
WP-CLI -d memory_limit override |
One CLI process | Shell access | Fully temporary and precise | Separates CLI configuration from web failures |
| Batching or reducing the workload | Imports, exports, media, and other heavy operations | Depends on the plugin or workflow | Often reversible; produces useful before-and-after evidence | Addresses peak allocation rather than merely increasing the cap |
10. Troubleshooting branches for common situations
The front end is down, but wp-admin works
Capture the public-request error, set or verify WP_MEMORY_LIMIT, and inspect the failing theme or front-end plugin. Use Recovery Mode if the recovery email identifies an extension. Do not raise only the admin limit; it will not change a front-end request.
Best Value
wp-admin crashes during updates or media work
Check WP_MAX_MEMORY_LIMIT and the server ceiling. Test with a smaller media batch or a reduced import. If only one plugin’s screen fails, isolate that plugin instead of raising the global limit indefinitely.
The browser works, but a WP-CLI import fails
Compare wp --info, php -i | grep memory_limit, and php --ini with the web PHP configuration. Apply a one-command -d memory_limit override to confirm the diagnosis, then correct the CLI configuration or split the import.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsThe site crashes again after a successful memory increase
Review the new log entry and identify whether the same file, task, and allocation recur. A repeated failure at a higher value indicates an underlying plugin, theme, data-size, compatibility, or background-job problem rather than a missing constant.
Only scheduled tasks fail
Check the cron runner’s PHP binary and logs. Recovery Mode does not protect cron or background tasks, and a web-only memory change may not affect a separate CLI or queue worker. Run the task manually with the same environment and a temporary CLI limit to isolate it.
11. Prevent the next memory crash
- Keep WordPress core, plugins, themes, PHP, and server extensions within their supported compatibility ranges.
- Remove unused plugins and avoid overlapping features that process the same content.
- Schedule large imports, exports, image operations, and updates in smaller batches during low-traffic periods.
- Monitor PHP and web-server logs after deployments, PHP upgrades, and plugin updates.
- Maintain tested backups before changing PHP configuration or replacing core and extension files.
- Document the effective web and CLI memory limits so future troubleshooting does not assume they are identical.
- Ask the host about per-process limits, concurrent-worker limits, and log access when a site repeatedly reaches the cap despite reasonable WordPress settings.
The durable fix is the smallest change that lets the intended workload complete while the logs show no recurring expensive code. If a higher limit merely moves the crash to a larger number, revert the temporary increase and continue isolating the component or workload that consumes memory.
Quick Recap
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.

