WordPress

Increasing the WordPress Memory Limit

When WordPress or a plugin dies with a memory exhaustion error, the fix is to raise the PHP memory limit, and on Kapsule that is a dropdown in KPanel rather than a file edit. This guide covers what the error means, how to change the limit, which value to pick, and what to do when more memory does not help.

What the Error Looks Like

The clearest form is a fatal error printed on the page or written to your error log:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes)

Divide the byte figure by 1,048,576 to read it in megabytes: 268435456 is 256 MB, 134217728 is 128 MB.

It does not always announce itself that clearly. The same underlying problem shows up as:

  • A completely blank white page with no message at all, often on one specific screen.
  • The WordPress dashboard loading but a single admin page (Plugins, Products, Site Health) dying.
  • A media upload or an import that gets partway and stops.
  • A 500 error that appears only under load.

Before you change anything, confirm it really is memory. Open the site's Advanced, then PHP tab, scroll to PHP error log, and click Load log. That shows the last 200 entries with a level filter. A memory exhaustion error appears as a Fatal. If the log is empty, the problem is elsewhere: try WordPress White Screen and Reading Your Error Logs.

Changing the Limit in KPanel

  1. Sign in to KPanel and click Websites in the left sidebar.
  2. Click the site you want to change.
  3. In the site's own menu, open Advanced, then PHP.
  4. Find the PHP settings card and the Memory limit row.
  5. Choose a value from the dropdown: 128M, 256M, 512M, 1024M or 2048M.
  6. Click Save Settings.

PHP settings on a site in KPanel

No restart is needed and the site stays up throughout. Your settings are written to a .user.ini file at the root of your site, which KPanel manages for you.

The new value is not always live on the very next page load. The server caches .user.ini for up to five minutes, so if the old limit is still being reported, wait a few minutes and check again before assuming the change did not take.

The same card controls four other values that often need adjusting alongside memory:

SettingOptionsRaise it when
Memory limit128M to 2048MFatal memory errors, blank admin screens
Max execution time30 to 600 secondsImports, exports and report builds that stop partway
Max upload size16M to 256MA theme zip or video is rejected as too large
Max input variables1000 to 10000Large menus, big forms, products with many variations

Post max size is not shown because Kapsule sets it automatically, always 1 MB above your upload limit, so a form carrying a file at the limit still fits.

Which Value to Choose

Every Kapsule site starts at 256M, which is already double the WordPress default and enough for the large majority of sites. Move up only when you have an actual error.

SiteSuggested limit
Brochure site or blog on a light theme256M is plenty
Site on a page builder theme with 20 or more plugins256M, then 512M if errors persist
WooCommerce store, modest catalogue256M
WooCommerce with subscriptions, many variations, or heavy inventory plugins512M
Multisite network or large membership site512M to 1024M

Do not jump straight to 2048M. A very high limit does not make a site faster: it lets a runaway plugin consume far more of the server before it fails, which turns a single broken page into a slow site for every visitor. Raise one step, retest, and stop as soon as the error is gone.

Setting a Limit in wp-config.php

The KPanel dropdown sets the server ceiling. WordPress has its own two constants that request memory up to that ceiling, and some documentation will tell you to set them:

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

WP_MEMORY_LIMIT applies to the front end. WP_MAX_MEMORY_LIMIT applies to the admin area, which normally needs more. Add them above the /* That's all, stop editing! */ line in wp-config.php, using the built in editor at Files, then File Manager, or over SFTP.

A WordPress constant can never exceed the server limit. Setting WP_MEMORY_LIMIT to 1024M while the KPanel dropdown says 256M gets you 256M and a false sense that you fixed it. Always raise the KPanel value first.

For most people the constants are unnecessary. Set the KPanel value and leave wp-config.php alone.

WooCommerce Notes

Stores are the most common reason to go past 256M. Check the store's own view of the limit at WooCommerce, then Status in wp-admin: the System Status report prints the PHP memory limit it can see, which is a good way to confirm your KPanel change actually landed.

Raise to 512M if you run any of these:

  • Variable products with dozens of variations each.
  • WooCommerce Subscriptions or a bookings extension.
  • Two or more payment gateway plugins active at once.
  • An inventory or accounting sync that runs in the background.

Slow or timing out WooCommerce admin pages are usually a combination of memory and execution time. Raise Max execution time to 120 seconds at the same time, and consider the caching options in Setting Up WooCommerce.

Check Your PHP Version Too

If memory errors started right after a PHP change, the version itself may be involved: an older plugin can leak badly on a newer runtime. The PHP version card at the top of the same tab shows what the site is running and lets you move between PHP 8.4, 8.3, 8.2 and 8.1.

Changing version restarts the site's PHP pool, so expect a few seconds of downtime. Full detail is in Changing Your PHP Version.

When More Memory Does Not Fix It

Raising the limit twice with no improvement means something is consuming memory it should not. Work through this in order:

  1. Take a backup. Taking a Backup first, every time.
  2. Find the plugin. Deactivate plugins in halves rather than one at a time: turn off half, retest, then split whichever half still fails. You can also use Plugin safe mode on the WordPress tab, then Plugins, which switches every plugin off at once without deleting any plugin data.
  3. Test the theme. Switch to a default WordPress theme temporarily. A theme running heavy queries on every page load produces exactly this pattern.
  4. Look at the operation, not the site. If only imports fail, the problem is execution time and batch size, not memory. Import in smaller chunks.
  5. Read the log. The PHP error log on the PHP tab names the file and line that ran out of memory, which usually identifies the plugin immediately.

If you are still stuck after 512M and a clean plugin test, email support@kapsulehost.com with the site domain, the exact fatal error line, and what you were doing when it happened.

Still need help?

Email us at support@kapsulehost.com or open a chat in KPanel.

Open KPanel
Increasing the WordPress Memory Limit