WordPress

WordPress memory limit vs PHP memory_limit

Understand the two memory settings and fix high usage instead of raising constants until the server fails.

By AppLaunch Editorial · Reviewed 2026-08-25

Direct answer

WordPress constants request an application ceiling, but PHP memory_limit remains the hard limit for each request. The lower setting wins, and the host must still support several PHP requests at once. Find the plugin, import or query using the memory before increasing both.

What this means in plain English

WordPress can ask PHP for a certain memory allowance through settings such as WP_MEMORY_LIMIT. PHP still has its own memory_limit, which is the hard ceiling for one process. WordPress cannot use more than PHP allows.

The host also runs several PHP workers at once. Raising every request to a very large limit can let a traffic spike use all server memory. Find the plugin, import or image task that uses the memory before changing limits.

Which memory limit actually applies?

WordPressWP_MEMORY_LIMIT / WP_MAX_MEMORY_LIMIT request
PHPHard memory limit for each request
HostSeveral PHP workers plus the database and operating system

A simple example

WordPress asks for 256 MB, but PHP allows only 128 MB, so the effective limit stays 128 MB. A large image import fails. The owner profiles the import, raises the correct web setting carefully and keeps normal worker concurrency within host capacity.

What to do, step by step

  1. 1. Capture the exact failing operation.

    Start here before buying anything or changing several settings at once. It gives you a clear starting point based on wordpress: wp_memory_limit / wp_max_memory_limit request. Write the result down so you can compare it later.

  2. 2. Inspect the PHP limit used by the website, not only the command line.

    Use the same files, versions and settings that the real project will use. A quick test with an empty or different setup can look successful while completely missing the problem you are trying to solve.

  3. 3. Measure plugin and theme memory where possible.

    Try the busiest realistic situation, not the easiest one. Include the people, data, traffic or background work you genuinely expect, then watch for slowdowns and errors rather than relying on a single headline number.

  4. 4. Raise the limit only after checking how many requests can run together.

    Finish by checking the result against host: several php workers plus the database and operating system. Keep the old setting or release available until you know the change works and can be reversed safely.

One more useful tip

Do not set unlimited memory in production. A broken plugin can then consume the whole machine instead of failing one request with a useful error.

Common mistakes and how to avoid them

Setting unlimited PHP memory.

This gives a misleading or unsafe result because it leaves out wordpress. A better approach is to capture the exact failing operation, then check the result before making the change permanent.

Editing wp-config after the stop-editing line.

This gives a misleading or unsafe result because it leaves out php. A better approach is to inspect the php limit used by the website, not only the command line, then check the result before making the change permanent.

Ignoring PHP requests that run at the same time.

This gives a misleading or unsafe result because it leaves out host. A better approach is to measure plugin and theme memory where possible, then check the result before making the change permanent.

Words explained

WordPress
A content management system that lets people edit pages and posts through an administration screen.
plugin
An add-on that gives WordPress extra features. Every plugin also adds code that must be updated and checked.
theme
The code and design files that control how a WordPress site looks.

Quick checklist

  • Capture the exact failing operation.
  • Inspect the PHP limit used by the website, not only the command line.
  • Measure plugin and theme memory where possible.
  • Raise the limit only after checking how many requests can run together.

Common questions

What is the simple answer?

WordPress constants request an application ceiling, but PHP memory_limit remains the hard limit for each request. The lower setting wins, and the host must still support several PHP requests at once. Find the plugin, import or query using the memory before increasing both.

What should I check first?

Start with wordpress: wp_memory_limit / wp_max_memory_limit request. That is usually more useful than choosing from a marketing label or copying somebody else’s setting.

How can I make the change safely?

Capture the exact failing operation. Then change one thing at a time, keep a backup or old version, and use the same real-world test after each change.

What is the easiest mistake to avoid?

Setting unlimited PHP memory. Avoiding that one mistake makes the rest of the comparison much more trustworthy.

Primary sources

  1. WordPress Site Health — WordPress.org
  2. Supported PHP versions — The PHP Group