EN · $ USD
WordPress and E-commerce

How to Increase the WordPress Memory Limit

7 min read Updated: Sunucu Atlas technical team

In short

To increase the WordPress memory limit, add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php and make sure PHP's memory_limit is not lower than that value. You can raise memory_limit with the cPanel MultiPHP INI Editor or a .user.ini file. No setting, however, can exceed your hosting plan's physical RAM limit.

In this guide
  1. What Does a Memory Limit Error Look Like?
  2. Check Your Current Values First
  3. Method 1: Raise the WordPress Limit in wp-config.php
  4. Method 2: Raise the PHP Limit with cPanel MultiPHP INI Editor
  5. Method 3: Set It Manually with a .user.ini File
  6. The Three Methods Compared
  7. Why the Physical RAM Limit Is What Really Counts
  8. Finding the Plugin That Uses Up Memory
  9. How Much Memory Does Each Plan Have?
  10. Confirm the Change Took Effect
  11. Next Step

Increasing the WordPress memory limit happens on two layers: WordPress's own limit (WP_MEMORY_LIMIT) and PHP's limit (memory_limit). WordPress can never use more than PHP allows, and PHP can't exceed your hosting plan's physical RAM limit. In this article we compare three methods, show which value goes where, and explain when the problem is a resource issue rather than a setting.

What Does a Memory Limit Error Look Like?

When the limit is too low, the PHP script stops midway and you'll see a line like this in the error log or on screen:

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted
(tried to allocate 20480 bytes) in /home/kullanici/public_html/wp-includes/...

Here, 134217728 bytes equals 128 MB, so the current limit is 128 MB. If the error isn't shown on screen, the symptom is usually a white screen, a plugin update that stops halfway, a page editor that won't load, or a large import that hangs. For other causes of a blank page, see the WordPress white screen of death guide.

Check Your Current Values First

Before changing anything, see what you're working with. In the WordPress dashboard, open Tools > Site Health > Info:

  • PHP memory limit in the Server section: this is PHP's memory_limit value.
  • WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT in the WordPress Constants section: the values WordPress requests for the front end and the admin dashboard.

By default, WordPress requests 40 MB for the front end on a single site and 64 MB on multisite; the default WP_MAX_MEMORY_LIMIT for admin tasks is 256 MB. If the PHP limit is higher than these values, WordPress applies its own value.

Method 1: Raise the WordPress Limit in wp-config.php

This method tells WordPress how much memory to request. Open wp-config.php in the root directory with File Manager or FTP and add these lines above the /* That's all, stop editing! */ line:

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

Note: these lines have no effect if they're higher than PHP's memory_limit and the server doesn't let scripts raise the limit. If the value doesn't change on the Site Health screen, the cap is on the PHP side; move on to method 2 or 3.

Method 2: Raise the PHP Limit with cPanel MultiPHP INI Editor

On cPanel accounts this is the cleanest, most durable method, because it creates the right configuration without editing files by hand.

  1. In cPanel, open the MultiPHP INI Editor tool in the Software section.
  2. On the Basic Mode tab, pick your domain or home directory from the dropdown.
  3. Find the memory_limit row and set the value to, for example, 256M.
  4. If you run large imports, review max_execution_time, upload_max_filesize and post_max_size on the same screen.
  5. Save with Apply and confirm the value on the Site Health screen.

For changing the PHP version and other PHP settings, the cPanel PHP version and settings guide walks through each screen in detail.

Method 3: Set It Manually with a .user.ini File

When PHP runs in modes such as FastCGI or LiteSpeed LSAPI, it reads a per-directory .user.ini file. MultiPHP INI Editor actually writes this kind of file behind the scenes. To create one by hand, add a file named .user.ini to the site's root directory (public_html):

memory_limit = 256M
max_execution_time = 120

By default this file is read with a 300-second cache time (user_ini.cache_ttl), so the change can take a few minutes to apply. The php_value memory_limit 256M line that some guides tell you to put in .htaccess only works when the server runs PHP in a mode that understands that directive; in an incompatible environment it causes a 500 error. So prefer .user.ini or the INI Editor.

The Three Methods Compared

MethodWhat it changesWhen to use itRisk
wp-config.phpMemory WordPress requestsWhen the PHP limit is already high enoughCan't exceed the PHP limit
MultiPHP INI EditorPHP memory_limitFirst choice on cPanel accountsLow
.user.iniPHP memory_limit (per directory)No panel access, or for a subdirectoryDelayed effect due to caching
.htaccess php_valuePHP memory_limitOnly in compatible environments500 error

Practical tip: first raise memory_limit with the INI Editor, then match the WordPress value to it in wp-config.php.

Why the Physical RAM Limit Is What Really Counts

memory_limit is the cap for a single PHP process, not your account's total memory. Shared and WordPress hosting plans also have a total RAM limit at the account level. When several visitors load pages at the same time, each request is handled by a separate PHP process, and total usage climbs quickly.

A rough example (for guidance only): if one page request uses close to 128 MB, 8 simultaneous requests add up to about 1 GB. On an account with 1 GB of physical RAM, setting memory_limit to 1024M won't fix anything; a single heavy process eats all the memory and other visitors start getting errors. For errors you see when the account limit is hit, see the 508 Resource Limit Is Reached error.

So the sensible order is:

  1. Raise the limit to a reasonable value (256 MB for most sites).
  2. If the error continues, find the plugin using the memory: disable plugins one at a time and test again.
  3. If the site has genuinely grown (many plugins, a page builder, WooCommerce, heavy traffic), move to more physical RAM.

Finding the Plugin That Uses Up Memory

Raising the limit often just hides the symptom; the real question is what's using that memory. These methods narrow down the source quickly:

  1. Read the error line: The file path in the error message (wp-content/plugins/eklenti-adi/...) often points straight at the culprit.
  2. Temporarily install the Query Monitor plugin: It shows each page's peak memory usage, query count and load time in the admin bar. Remove it when you're done.
  3. Disable plugins one by one: Reload the problem page after disabling each plugin; where memory usage drops, you've found the source.
  4. Check scheduled tasks: Backup, image optimization and import plugins run heavy jobs in the background; move those jobs to low-traffic hours.

Guideline values

The values below aren't hard rules; they're starting points based on common use:

Site typeWP_MEMORY_LIMITWP_MAX_MEMORY_LIMIT
Blog, brochure site128M256M
Business site using a page builder256M256M - 512M
WooCommerce store256M - 512M512M

When choosing these values, make sure they stay within your account's total RAM and leave room for several simultaneous requests.

How Much Memory Does Each Plan Have?

Sunucu Atlas WordPress hosting plans offer 1 GB to 4 GB of physical RAM, and all run on LiteSpeed Web. A simple blog or brochure site runs comfortably on the 1 GB entry plan, while for business sites using a page builder and many plugins, the SA-WP-2 plan, with 2 GB RAM, a 2-core CPU and 40 GB NVMe storage, is a starting point that can actually back up a higher memory limit. To choose a plan by visitor count, you can also read the which WordPress hosting plan guide.

Confirm the Change Took Effect

After making the change, measure instead of guessing. The most reliable way is to see the value the server actually uses:

  1. Refresh the Tools > Site Health > Info screen and check both the PHP memory limit and WP_MEMORY_LIMIT.
  2. If you have SSH access, query the value WordPress sees with WP-CLI: wp eval 'echo WP_MEMORY_LIMIT;'
  3. Repeat the action that triggered the error (plugin update, import, page editing) and check whether a new "Allowed memory size" line appears in the error log.

If the value didn't change, suspect these in order: the .user.ini cache hasn't refreshed yet, the file is in the wrong directory, or the setting was made for a different PHP version. In MultiPHP INI Editor, make sure the domain you selected matches the directory the site actually runs from.

Next Step

First note your current values on the Site Health screen, then raise the limit to 256 MB with the INI Editor and wp-config.php. If the error persists and your plugins are clean, the problem is resources, not settings. In that case, move to SA-WP-2 with 2 GB RAM or one of the higher WordPress hosting plans to give your site the physical memory it needs.

Frequently asked questions

What is the ideal memory limit for WordPress?

256 MB is enough for most sites. Simple blogs can run on 128 MB; for sites using WooCommerce or a page builder, 256 MB to 512 MB is a common range.

I added WP_MEMORY_LIMIT to wp-config.php but the value didn't change. Why?

WordPress can't exceed PHP's memory_limit. Check the PHP memory limit on the Site Health screen and, if needed, raise the PHP limit with MultiPHP INI Editor or .user.ini.

What is the difference between WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT?

WP_MEMORY_LIMIT applies to the front end visitors see, while WP_MAX_MEMORY_LIMIT is the limit for heavy admin tasks such as image processing and updates.

Is there any harm in setting the memory limit very high?

Yes. If the value gets close to your account's physical RAM, a single faulty process can consume all the memory and cause errors for other visitors. Keep the limit at a reasonable level instead of using it to hide the problem.

Why did raising the memory limit in .htaccess cause a 500 error?

The php_value directive only works on servers that run PHP in a mode that understands it. In an incompatible environment it causes a 500 error; delete the line and use .user.ini or MultiPHP INI Editor instead.

For this guide

Recommended plans

A higher memory limit needs physical RAM to back it up. SA-WP-2, with 2 GB RAM and LiteSpeed Web, is a balanced starting point for plugin-heavy WordPress sites.

SA-WP-2

cPanel
Recommended

40 GB NVMe disk

$0.69/mo

+VAT

  • Processor2 cores
  • Memory2 GB
  • LocationIstanbul
  • WordPress One-Click Install (WP Toolkit)
  • 1 Hosted Domains
  • 100 GB Traffic
  • 10 Email Account Limit

SA-WP-1

cPanel

20 GB NVMe disk

$0.39/mo

+VAT

  • Processor1 cores
  • Memory1 GB
  • LocationIstanbul
  • WordPress One-Click Install (WP Toolkit)
  • 1 Hosted Domains
  • 50 GB Traffic
  • 5 Email Account Limit

SA-WP-3

cPanel

60 GB NVMe disk

$0.98/mo

+VAT

  • Processor3 cores
  • Memory3 GB
  • LocationIstanbul
  • WordPress One-Click Install (WP Toolkit)
  • 1 Hosted Domains
  • 200 GB Traffic
  • 25 Email Account Limit

WordPress Hosting — tüm paketler

Need help with setup?

Send questions about your service in a support ticket, and our technical team will walk you through it step by step.