PHP Allowed Memory Size Exhausted: What It Means and How to Fix It

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted means a PHP script tried to use more memory than it's allowed, so PHP stopped it. Your visitors usually see a blank page, a 500 error, or WordPress's "There has been a critical error on this website" message. This guide explains what the allowed memory size exhausted error means and how to fix it by raising memory_limit in your Instant Access Internet Services cPanel -- and when raising it won't help.

What the error looks like

You'll find it in your error_log file, WordPress's debug.log, or the WordPress "Technical Issue" email:

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /home/username/public_html/wp-content/plugins/some-plugin/file.php on line 123

It tells you three things:

  • The limit ("Allowed memory size of ... bytes"). This is your current memory_limit.
  • How much more it wanted ("tried to allocate ... bytes"). Usually small -- the script used up the limit bit by bit.
  • Where it ran out. The file path often names the plugin or theme at fault, but not always: the script that ran out may just be the last straw.

To turn the byte number into a setting:

Number in the errormemory_limit
6710886464M
134217728128M (our default)
268435456256M
536870912512M

How to fix it: raise memory_limit in MultiPHP INI Editor

  1. Log in to cPanel and go to Software > MultiPHP INI Editor.
  2. On the Basic Mode tab, choose your domain from the menu under Configure PHP INI basic settings.
  3. Find memory_limit and change it to 256M.
  4. Click Apply.
  5. Reload the page that failed.

256M is enough for most WordPress and WooCommerce sites. Large shops, page builders and big imports sometimes need 512M. Only go higher if a plugin's documentation specifically asks for it. For more on this editor, see How to Change PHP Settings (memory_limit, upload_max_filesize).

If the change doesn't take effect

If the error still shows the old number, something else is setting the limit:

  • Wrong domain. Check you picked the right domain (a subdomain site needs its own setting) and clicked Apply.
  • Old settings files. Look in your site folder for php_value memory_limit lines in .htaccess, or a php.ini or .user.ini copied from a previous host. Remove the old line so the MultiPHP INI Editor value wins. (php_value lines in .htaccess can also cause 500 errors, so it's best to remove them anyway.)
  • WordPress settings. wp-config.php may contain WP_MEMORY_LIMIT or WP_MAX_MEMORY_LIMIT. These are fine to leave, but if one is set to a small value, raise it to match, for example define( 'WP_MEMORY_LIMIT', '256M' );.

In WordPress you can confirm the current value under Tools > Site Health > Info, in the Server section ("PHP memory limit").

When raising the limit won't help

A higher memory_limit fixes the error when a script genuinely needs a bit more room. It doesn't fix a script that's broken. Suspect a bug if:

  • The error keeps coming back at every limit you try (256M, then 512M).
  • The "tried to allocate" number is huge, such as hundreds of megabytes or more in one go.
  • It started right after a plugin or theme update.

In those cases, update or disable the plugin or theme named in the error path. If you can't reach your dashboard, rename the plugin's folder in Files > File Manager as described in WordPress Critical Error on This Website: How to Fix It.

Also keep your whole account in mind. memory_limit is per script, but every visitor request runs its own copy, and your account has an overall memory limit shown in Metrics > Resource Usage (cPanel Resource Usage Explained: CPU, Memory and Entry Process Limits). Setting memory_limit very high lets a single runaway script use far more of that total, which can lead to 508 Resource Limit Is Reached errors for everyone (508 Resource Limit Is Reached: What It Means and How to Fix It).

A similar error: "Out of memory"

If the log says PHP Fatal error: Out of memory (allocated ...) (tried to allocate ...) without "Allowed memory size", the script didn't hit memory_limit -- it hit your account's overall memory limit. Check Metrics > Resource Usage for memory faults, turn on caching (How to Speed Up WordPress with LiteSpeed Cache), and look for heavy plugins. Raising memory_limit won't help that one.

When to open a ticket

Open a ticket if the new limit won't apply, or you've raised it to 512M and the error continues. Include the full error line from the log, the page or task that triggers it (for example "saving a product" or "running an import"), and the value you set.

Related guides

Still stuck? Open a support ticket and the Instant Access Internet Services team will help.

Ultrafast LiteSpeed hosting from InstantAccess.net: free SSL, free backups, cPanel included, no contracts. Check out our $10/month hosting.
  • allowed memory size exhausted, php fatal error allowed memory size of 134217728 bytes exhausted, increase php memory limit, wordpress memory exhausted, memory_limit cpanel, wp_memory_limit
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

429 Too Many Requests: What It Means and How to Fix It

A 429 Too Many Requests error means something decided that one visitor, program or website sent...

500 Internal Server Error: What It Means and How to Fix It

A 500 Internal Server Error means the web server hit a problem it couldn't recover from while...

400 Bad Request Error: What It Means and How to Fix It

A 400 Bad Request error means the server received a request it couldn't understand, so it refused...

401 Unauthorized Error: What It Means and How to Fix It

A 401 Unauthorized error means the page you asked for needs a login, and the server didn't...

403 Forbidden Error: What It Means and How to Fix It

A 403 Forbidden error means the server understood the request but refused to show the page....