WordPress

WordPress PHP memory limit: how to check it and fix memory errors

A WordPress memory limit controls how much memory one PHP request can use. WordPress can request a higher application limit, but PHP and the hosting platform can still impose a lower ceiling. This is different from the total RAM assigned to the server or hosting account.

Start with the exact memory error

The common PHP fatal error says that an allowed memory size was exhausted and usually reports both the configured byte limit and the allocation that failed. Record the page or task, the time, and the plugin, theme, import, image operation or background job involved before changing settings.

If there is no memory-exhaustion error, do not assume a slow or failed WordPress request is a memory problem. Timeouts, database errors, PHP exceptions and resource limits have different fixes.

Troubleshoot PHP timeouts separately

PHP memory_limit is the server-side ceiling

PHP has a memory_limit configuration directive that limits memory for a script. Hosting providers can set or restrict that value. The PHP configuration used by the website can also differ from command-line PHP, so a CLI check is not proof of the limit serving WordPress.

If the hosting platform enforces a lower limit, changing a WordPress constant cannot override that server-side boundary.

PHP manual: memory_limit

WordPress has its own memory settings inside that boundary

WordPress supports WP_MEMORY_LIMIT for normal requests and WP_MAX_MEMORY_LIMIT for some administration tasks. These settings tell WordPress what it may request; they do not create physical memory or guarantee PHP will permit the requested value.

Check the effective web-PHP limit and the WordPress configuration together. If they disagree, the lower enforceable boundary is the one that matters for the failing request.

WordPress developer docs: increasing memory allocated to PHP

There is no single correct memory limit for every WordPress site

A small brochure site and a large WooCommerce import can have very different peak memory use. Raising a limit can be reasonable when a legitimate operation needs more headroom and the hosting plan has capacity, but choose the new value from measured workload and available capacity; there is no universal tutorial value.

Keep enough headroom for concurrent PHP workers too. A per-request limit multiplied across many simultaneous requests can become a much larger account or server memory demand.

Repeated growth is an application signal

If the same action keeps consuming more memory after increases, investigate plugins, themes, database queries, imports, image processing, background jobs and loops. More memory can postpone the next failure without fixing a leak or runaway workload.

After a change, repeat the operation that failed and watch logs and resource use. A successful test of the actual workload is stronger evidence than a settings screen alone.

Upgrade hosting when the workload actually needs more capacity

If the application is healthy but its normal requests and concurrency no longer fit the hosting plan, compare a larger shared plan or VPS. Do not move to a larger server solely because one plugin produced a memory error once.

For DotMoose WordPress hosting, compare the current plan limits and ask support if you need help distinguishing an application problem from a hosting boundary before moving plans.

Common questions

What is the WordPress PHP memory limit?

It is the amount of memory available to a PHP request running WordPress, subject to both WordPress settings and the PHP/hosting configuration. It is not the same as the server’s total RAM.

What does “Allowed memory size exhausted” mean in WordPress?

PHP reached the memory limit for that request while trying to allocate more memory. Record the failing operation and logs, then check the effective PHP and WordPress limits before deciding whether to raise a limit or fix the application.

What is the recommended WordPress memory limit?

There is no single correct value for every WordPress site. The appropriate limit depends on the application workload, plugins, themes, administrative tasks, concurrency and the capacity of the hosting plan.

Can WP_MEMORY_LIMIT override PHP memory_limit?

Not beyond a server-side limit that PHP or the hosting platform enforces. WordPress can request memory within the environment it is given; it cannot manufacture memory beyond the effective hosting boundary.

Related DotMoose serviceCompare WordPress hosting resources

Keep reading

Related guides.

More wordpress →