Skip to content
WordPress3 min read

How to fix the WordPress memory exhausted error

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

Short answer

"Allowed memory size of ... bytes exhausted" appears when WordPress or a plugin needs more memory than PHP's memory_limit allows. Raise the limit in cPanel's MultiPHP INI Editor and set WP_MEMORY_LIMIT in wp-config.php; if the error keeps coming back, track down the plugin that's using the memory.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Common causes
  2. How to fix it
  3. Prevention
  4. On ArabyHost

Every PHP process has a maximum amount of memory set by memory_limit. When a plugin, theme or WordPress itself tries to go past it, execution stops with a fatal error. Visitors usually see a white screen or “There has been a critical error”, and the full text lands in the error log. The number in the message is the current limit in bytes:

Number in the message Limit
67108864 64M
134217728 128M
268435456 256M
536870912 512M

Common causes

  • A low PHP limit for a site with many plugins or a page builder.
  • A heavy plugin: data imports, backups, image processing or store reports.
  • A big dashboard task, such as editing a long page or exporting products.
  • A plugin bug that loops endlessly and eats whatever memory it gets.

How to fix it

1. Raise PHP’s memory_limit

  1. In cPanel open Software » MultiPHP INI Editor.
  2. On the Basic Mode tab, pick the domain from the list.
  3. Set memory_limit to 256M and click Apply.

2. Set WordPress’s limit in wp-config.php

Open wp-config.php in Files » File Manager and add above That's all, stop editing!:

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

WP_MEMORY_LIMIT applies to the front end and defaults to 40M. WP_MAX_MEMORY_LIMIT is used in the dashboard and for tasks like image processing, and defaults to 256M. WordPress raises PHP’s limit to these values when the server allows it.

3. Confirm the effective value

In WordPress go to Tools » Site Health » Info and check the Server and WordPress Constants sections for the new limit.

4. Find the memory-hungry plugin

If the error returns even with the higher limit, read the end of the message: in /home/user/public_html/wp-content/plugins/plugin-name/... usually points at a plugin. Disable it by renaming its folder and test. Keep in mind the file named is where memory ran out, not necessarily what consumed it, so try disabling heavy plugins one at a time.

5. Mind the account’s resource limit

memory_limit is per PHP process, but the account as a whole also has a memory limit. Exceed that and you may see 508 Resource Limit Is Reached instead, which raising memory_limit alone won’t fix.

Prevention

  • Remove unused plugins and prefer actively maintained ones.
  • Turn on page caching so pages aren’t rebuilt on every visit.
  • Run heavy jobs such as imports and exports in small batches.

On ArabyHost

You set memory_limit per domain in MultiPHP INI Editor in cPanel, opened with one click from the Araby Panel. Server resources are shared, but every account has its own limits (LVE) under CloudLinux, so your site can’t go beyond its account limit however high you set memory_limit. LiteSpeed Cache reduces the number of PHP requests, and the Araby AI assistant reads the error logs and points to the plugin that used the memory. If your site needs more resources, see plans and pricing.

FAQ

What should I set WP_MEMORY_LIMIT to?

256M is enough for most WordPress sites and small stores. If a site constantly needs more, it's better to find the plugin responsible than to keep raising the limit.

I raised WP_MEMORY_LIMIT but the number in the error didn't change. Why?

The constant has no effect if it's placed after the line that loads WordPress in wp-config.php, or if PHP's own limit is lower and can't be changed at runtime. Put it above "That's all, stop editing!" and raise memory_limit in MultiPHP INI Editor.

Does raising the memory limit slow the site down?

Not by itself: the limit is a ceiling, not fixed usage. But needing a lot of memory is a sign of a heavy plugin, and that's what usually slows a site.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.