October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober 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 Increase the WordPress Memory Limit (and Fix “Allowed Memory Size Exhausted”)

A step-by-step guide to WordPress memory limits: set WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT, raise PHP’s ceiling when your host allows it, verify the result and fix the workload causing repeated memory exhaustion.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To request more memory for WordPress, edit the site’s wp-config.php and add WP_MEMORY_LIMIT and, when needed, WP_MAX_MEMORY_LIMIT before the line that loads wp-settings.php. A typical starting point is 128M for frontend requests and 256M for administration. Those constants cannot exceed the PHP memory_limit enforced by your server, so a host-level change may be necessary. If exhaustion continues after the limit is raised, the plugin, theme, import, image job or other workload still needs investigation.

What the WordPress memory limit actually controls

WordPress runs inside PHP. Every request—loading a page, opening the dashboard, running a background task, processing an image or importing content—gets a finite amount of PHP memory. When a request exceeds that allowance, PHP stops it and commonly reports Allowed memory size exhausted.

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.

WordPress exposes two constants in wp-config.php so it can request different allowances for different parts of the application:

Constant Applies primarily to WordPress-documented default What it does
WP_MEMORY_LIMIT Frontend requests and ordinary site loads 40M on single-site installations; 64M on Multisite Requests the maximum memory WordPress should use for normal PHP requests
WP_MAX_MEMORY_LIMIT Administration and other backend work 256M for administration Requests a higher allowance for dashboard operations and resource-intensive backend tasks

The figures in the table are defaults documented by WordPress.org Developer Resources, not promises that every host will provide those amounts. The effective ceiling is PHP’s memory_limit directive. A constant in wp-config.php can ask for a value, but it cannot force PHP or a hosting provider to grant more than the server policy allows.

That distinction explains why a configuration edit sometimes appears to do nothing: WordPress may be requesting 256M while PHP is still limited to 128M, or the request may be running under a different PHP configuration than the one you edited.

Before editing: protect the site and locate the right file

Back up the configuration

Download a copy of wp-config.php before making changes. A missing semicolon, misplaced quote or accidental deletion can prevent WordPress from loading. Keep the backup outside the public web root and do not paste database passwords from the file into support forums.

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

Find the WordPress root directory

The correct file is the wp-config.php belonging to the installation that is failing. It is normally in the WordPress root, alongside directories such as wp-admin, wp-includes and wp-content. Hosts with a one-click installer, staging area or multiple sites can leave several similarly named files, so confirm the document root for the affected domain.

Confirm how you can edit it

  • Use the host’s file manager, SFTP or SSH if those are available.
  • Make sure the file remains writable by the account that runs WordPress, but do not loosen permissions more than necessary.
  • Schedule the change when you can immediately test the failed operation and restore the backup if the site produces a syntax error.

Method 1: set WordPress constants in wp-config.php

Place the definitions before wp-settings.php

Open wp-config.php and find the line that loads WordPress settings:

require_once ABSPATH . 'wp-settings.php';

Add the constants above that line, not below it:

define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Save the file, close the editor and test the operation that failed. Defining the constants after wp-settings.php has loaded is too late for WordPress to apply them reliably.

Set only the scope you need

If only public-page requests run out of memory, start with WP_MEMORY_LIMIT. If the failure occurs while editing, updating, importing or performing another dashboard task, WP_MAX_MEMORY_LIMIT is the relevant request. Many sites set both so frontend and administration have explicit values, but a larger backend allowance does not automatically increase the frontend allowance.

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

Choose a value that your host can actually provide

The example values above are practical starting requests, not universal WordPress requirements. A small site may work below them; a page builder, large catalog, backup operation or image conversion may need more. Raising a value far beyond the workload can hide a defective extension and consume resources needed by other sites on the same account.

Avoid common PHP syntax mistakes

  • Use straight single quotes and retain the semicolon at the end of each define() statement.
  • Use a value such as '128M', with the unit included. Do not write an unquoted number.
  • Do not add a second conflicting definition elsewhere in the file. Keep one clear definition for each constant.
  • Do not put the lines inside a comment block or inside another function.

Verify the effective value inside WordPress

Use Site Health

  1. Sign in to the WordPress dashboard.
  2. Open Tools → Site Health.
  3. Choose the Info tab, expand Server and inspect the displayed PHP memory limit and related server values.
  4. Retry the operation that previously failed rather than testing only a static page.

The Server section shows what PHP reports for the running site. If it still shows the old value, the request was not changed, the edit was made in the wrong installation, or the host is enforcing a lower ceiling.

Check the PHP configuration used by the site

Your host may provide a PHP information screen or a control-panel selector for the active PHP version and configuration. Compare the reported memory_limit with the values requested in wp-config.php. Command-line PHP and web-server PHP can load different configuration files, so a value seen in a terminal is not proof of the value used for browser requests.

Do not confuse memory with upload limits

post_max_size and upload_max_filesize govern the size of submitted request data and individual uploads. Increasing either one does not increase the PHP memory available to WordPress. A large image can require substantial processing memory even when the upload itself is permitted, so these settings may need separate adjustment.

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

Why wp-config.php may not change PHP’s memory limit

WordPress documentation describes the constants as requests made at runtime. The server still decides whether those requests succeed. The PHP memory_limit directive is the controlling ceiling for memory used per page render.

Method Control layer Main scope Can it raise the PHP ceiling? Host dependency
WP_MEMORY_LIMIT in wp-config.php WordPress runtime Frontend and normal requests No; it requests an allowance up to the PHP ceiling Works only within the limits the server permits
WP_MAX_MEMORY_LIMIT in wp-config.php WordPress runtime Administration and backend work No; it cannot exceed PHP’s limit Works only within the limits the server permits
php.ini PHP/server configuration Requests using that PHP configuration Yes, if you control the configuration and available server resources Often restricted on shared hosting
.user.ini Per-user PHP configuration, where supported The site or account covered by the file Potentially, subject to PHP and host policy Depends on the PHP handler and host settings
.htaccess with php_value Web-server configuration, where supported Requests handled by that directory Potentially, subject to the server’s PHP integration Unsupported combinations can cause an HTTP 500 error
Hosting support request Provider’s server or account policy Whatever scope the provider changes Yes, when the provider raises the enforced ceiling Depends on the plan and available resources

Raise the server-level PHP limit when the host allows it

Edit php.ini

If you administer the server or your host exposes a site-specific php.ini, set the directive there. WordPress’s troubleshooting guidance gives this form as an example:

memory_limit = 300M

The file and restart or reload procedure vary by hosting stack. After applying the change, revisit Tools → Site Health → Info → Server and verify the value used by web requests. A command-line check alone may inspect a different PHP installation.

Use .user.ini where the stack supports it

Some FastCGI-based configurations honor a .user.ini file in the site directory. Add the same directive only when your provider documents that this method is enabled:

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

PHP may cache per-user configuration for a period of time, so the new value might not appear immediately. Follow the host’s documented reload and cache behavior rather than repeatedly editing the file.

Use .htaccess only on compatible Apache configurations

WordPress’s FAQ gives this example for servers that permit PHP directives in .htaccess:

php_value memory_limit 300M

This syntax is not portable. If PHP runs through a handler that disallows php_value, the site can immediately return a 500 error. Back up .htaccess, add the line carefully and be ready to remove it through SFTP or the host file manager if the site becomes unavailable. Nginx configurations do not use Apache .htaccess directives.

Ask the host when overrides are blocked

Shared hosts commonly prevent customers from changing the server-wide or account-level memory_limit. Contact support with the domain, the current value shown in Site Health, the value you need for the specific workload and the time of the failure. The provider may raise the limit, move the site to a different PHP profile or explain that the plan has a fixed ceiling. WordPress documentation explicitly notes that some hosts do not allow PHP memory increases automatically.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Choose the target by workload, not by a magic number

There is no single correct WordPress memory limit. Use the smallest value that completes the operation reliably, then leave reasonable headroom for concurrent requests. The following figures illustrate how to think about requests; they are not guarantees or WordPress-mandated requirements.

Workload Starting approach What to watch
Ordinary pages on a modest site Keep the documented default if it is sufficient; otherwise test a request such as 128M Frontend failures, caching configuration and unusually heavy plugins
Dashboard editing, updates or routine administration Request a backend allowance such as 256M when the host permits it Whether the failure occurs only in wp-admin or in scheduled tasks too
Large imports, exports or backup generation Increase temporarily if possible, and split the job into smaller batches Batch size, execution time, database load and the component that allocates memory
Image resizing, thumbnail regeneration or media conversion Provide enough headroom for the largest source image, then reduce image dimensions or process in batches Image dimensions, number of simultaneous files and the image library in use
Persistent failures despite a higher allowance Stop increasing the number blindly and investigate the workload Plugin or theme leaks, recursive hooks, malformed data and server logs

A value such as 512M can be reasonable for a specific, controlled task on a suitably provisioned server, but it is not a universal cure. On shared hosting, a high per-request limit can let one operation exhaust the account’s total resources and affect unrelated visitors.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Fix “Allowed memory size exhausted” systematically

Read the fatal-error message

The message normally includes the amount PHP allowed, the amount requested and the file and line where PHP stopped. The file named in the error is often where the final allocation occurred, not necessarily the original cause. Record the URL or admin action, the user role, the time and whether the failure happens every time.

Determine the failing path

  • If public pages fail, compare the frontend constant and the PHP ceiling, then check the active theme and frontend plugins.
  • If only the dashboard fails, inspect WP_MAX_MEMORY_LIMIT, administrative plugins, editors, update routines and scheduled actions.
  • If one import or export fails, reduce the batch size and test a smaller file before changing unrelated settings.
  • If only image operations fail, test a smaller image and review thumbnail or conversion jobs.

Use controlled isolation

  1. Back up the site and database before changing extensions.
  2. Disable the suspected plugin and repeat the exact operation.
  3. If the error disappears, re-enable other plugins one at a time and update or replace the component that triggers the failure.
  4. If it remains, switch temporarily to a standard theme and retest to distinguish theme code from plugin or server behavior.
  5. Review PHP and WordPress logs for warnings immediately before the fatal error. Restore normal extensions and the production theme after testing.

Break up expensive jobs

Process imports in smaller files, run image regeneration in batches and avoid starting several resource-heavy jobs at once. A request that succeeds at 256M when handling 500 records may still fail at the same limit with 20,000 records. Reducing the peak allocation often improves reliability more than raising the ceiling.

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

Check for recurring or scheduled failures

Some memory errors occur in cron tasks rather than during a browser request. Look for repeated failures in the host’s PHP log and WordPress’s scheduled-action or task screens. A successful homepage load does not prove that background processing has enough memory.

Common mistakes and their recovery steps

The constants are below wp-settings.php

Move them above the require_once ABSPATH . 'wp-settings.php'; line, restore the backup if the file became syntactically invalid, and check Site Health again.

You edited the wrong installation

Confirm the domain’s document root and the database associated with that directory. Staging copies, subdirectories and old installer folders frequently contain their own wp-config.php.

The host ceiling is lower than the request

If Site Health reports no increase, inspect memory_limit through the host’s PHP information and ask support whether account-level overrides are blocked. Changing upload settings or adding more WordPress constants will not bypass that policy.

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.

An .htaccess change caused a 500 error

Remove the new php_value line using SFTP or the file manager, restore the prior file, then use a supported php.ini, .user.ini method or a hosting request instead.

The error returns after every increase

Treat that pattern as evidence of a workload problem: a plugin or theme may allocate memory repeatedly, an import may be too large, or an image job may be processing files beyond practical dimensions. Capture the fatal-error path, isolate the component and reduce the job before requesting another increase.

A safe end-to-end procedure

  1. Back up wp-config.php and identify the active WordPress root.
  2. Record the current PHP memory_limit in Tools → Site Health → Info → Server.
  3. Add only the needed constants above the wp-settings.php include, beginning with a workload-appropriate request such as 128M and 256M.
  4. Save the file and verify the effective value in Site Health.
  5. Repeat the exact operation that failed and note whether the failure moved from frontend to backend, disappeared or remained unchanged.
  6. If the reported PHP ceiling is unchanged, use a supported php.ini or .user.ini setting, or ask the host to raise it. Use the .htaccess form only when the server explicitly supports it.
  7. If the fatal error persists, disable or replace the offending extension, split imports, reduce image-processing batches and inspect logs instead of raising the limit indefinitely.

The practical goal is not the largest number. It is a verified PHP allowance that matches the site’s real peak workload without concealing a component that is consuming memory abnormally.

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.

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

Leave a Reply

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

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
Crashes, No Sound, or Screen Glitches?Free driver scan
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.