A WordPress memory-limit error does not automatically mean your server is out of physical RAM. It usually means a PHP process reached the memory ceiling configured for that request. Before increasing the limit, identify which limit you are changing and why the site is using that much memory.
This guide separates the three values people commonly confuse: the server’s physical RAM, PHP’s memory_limit, and WordPress’s WP_MEMORY_LIMIT.
WordPress memory limit vs PHP memory limit vs server RAM
| Setting | What it controls | Where it is changed |
|---|---|---|
| Server RAM | The physical/virtual memory available to the VPS or hosting environment as a whole. | By changing the hosting/VPS resources. |
PHP memory_limit |
The maximum memory a PHP script/process is allowed to allocate. | PHP configuration, subject to the hosting environment and any provider-enforced cap. |
WP_MEMORY_LIMIT |
The WordPress-request memory target WordPress can attempt to use within the PHP environment. | wp-config.php, but it cannot magically create memory that PHP or the host does not allow. |
PHP documents memory_limit as the maximum amount of memory a script may allocate. WordPress documents WP_MEMORY_LIMIT as a way to specify the memory WordPress can consume, while noting that some hosts do not allow WordPress to raise the PHP limit automatically.
What does “Allowed memory size exhausted” mean?
An error such as Allowed memory size of ... bytes exhausted means a PHP process attempted to allocate more memory than its configured limit allowed. That can happen because the limit is genuinely too low for the workload, but it can also indicate an inefficient plugin, theme, import, backup, image-processing task, query, or background job.
Do not treat a higher memory limit as the only fix. If a previously stable site suddenly starts exhausting hundreds of megabytes after a plugin or application change, investigate the workload as well as the limit.
Step 1: Check the current PHP memory limit
Use the hosting environment’s PHP information or configuration tools to verify the active memory_limit. inCloudServer’s existing Change PHP Settings for My Hosting Account article explains the provider-specific PHP configuration workflow and how to confirm the effective settings.
Do not assume that editing a file changed the active PHP configuration. Always confirm the effective value after the change.
Step 2: Check whether the problem is WordPress-specific
If the error references a plugin, theme, import, backup process or image tool, temporarily reproduce the issue in a safe staging environment when possible. Look for a recent update or task that caused memory use to jump.
- Disable or replace a problematic plugin only after confirming it is involved.
- Check whether a large import, backup or image-generation job is creating temporary memory spikes.
- Review PHP and WordPress error logs for the file/function involved.
- Do not troubleshoot a production site by randomly disabling critical plugins without a rollback plan.
Step 3: Increase PHP memory_limit when the workload legitimately needs it
If the application genuinely needs more memory and your hosting plan allows it, raise PHP’s memory_limit through the supported configuration method for that hosting environment. The correct file or interface can vary by hosting product, which is why the generic PHP-settings KB should remain the source of truth for the account-level change.
The PHP manual uses values such as 128M and documents -1 as disabling the memory limit. Removing the limit entirely is not a sensible default for a production website because the limit exists partly to keep a runaway PHP process from consuming unlimited memory.
Step 4: Set WP_MEMORY_LIMIT only when it is appropriate
WordPress allows a memory target to be defined in wp-config.php. For example:
define( 'WP_MEMORY_LIMIT', '256M' );
That value is only an example, not a universal recommendation. Choose a value that fits the site and remains within what PHP and the hosting platform permit. WordPress’s documentation notes that some hosts do not allow WordPress to increase PHP memory automatically.
Add WordPress configuration changes only to the correct wp-config.php file and keep a backup before editing production files.
How much WordPress memory should you use?
There is no single correct number. A small brochure site and a WooCommerce store with page builders, multilingual plugins, backups and imports can have very different memory profiles.
| Situation | What to do |
|---|---|
| A lightweight site is stable below the current limit | Do not raise memory just because a larger number sounds better. |
| A legitimate task consistently reaches the current cap | Investigate the task, then raise the PHP/WordPress limit within the hosting platform’s supported range if appropriate. |
| Memory usage jumps after a plugin/theme change | Diagnose the change before simply increasing the ceiling. |
| The hosting plan cannot provide enough resources for normal operation | Compare a higher hosting tier or WordPress VPS Hosting if the site genuinely needs server-level resources. |
When increasing the WordPress memory limit will not fix the problem
- The plugin or theme has a memory leak or inefficient process.
- A database query or import is unreasonably large.
- The site is CPU-bound rather than memory-bound.
- The hosting account has another resource limit unrelated to PHP memory.
- The server itself is under memory pressure from multiple services or websites.
- A PHP configuration cap prevents WordPress from using the requested value.
Shared hosting vs WordPress hosting vs VPS for memory-heavy sites
If a WordPress site repeatedly needs more application resources, first determine whether the problem is optimization or actual capacity. Moving an inefficient workload to a larger server can make the symptom disappear temporarily without fixing the cause.
- WordPress Hosting: a good fit when you want a WordPress-focused environment without server administration.
- cPanel Hosting: useful when you want broader traditional hosting controls and the workload still fits shared hosting.
- WordPress VPS: appropriate when the site has a measured need for more isolated/server-level resources or custom configuration and your team can handle the added responsibility.
Still hitting hosting limits after troubleshooting?
Compare the current WordPress hosting options first. If the site genuinely needs server-level resources or configuration, compare WordPress VPS plans next.
Frequently asked questions
What is the WordPress memory limit?
It is the amount of PHP memory WordPress is allowed to use for a request, within the limits imposed by PHP and the hosting environment.
What is the difference between WP_MEMORY_LIMIT and PHP memory_limit?
WP_MEMORY_LIMIT is a WordPress configuration value. PHP memory_limit is the PHP runtime ceiling. WordPress cannot reliably exceed a lower host-enforced PHP limit.
Will increasing the WordPress memory limit speed up my site?
Not necessarily. A higher limit prevents memory exhaustion only when memory is the constraint. It does not automatically improve database queries, PHP execution time, network latency or frontend performance.
Should I set PHP memory to unlimited?
Usually no. PHP supports an unlimited setting, but a production memory ceiling can protect the server from a runaway process. Diagnose the workload and set an appropriate supported limit instead.
Official references: WordPress wp-config.php documentation and PHP memory_limit documentation.
Before changing WordPress/PHP memory settings on a production site, create a current recovery point. See the WordPress Backup guide.