Computer screen displaying code and project files server configuration, timeout settings, performance metrics

The safest memory setting starts in PHP, not WordPress. WordPress can request more memory, but PHP and the hosting stack decide the real ceiling. PHP documentation lists memory_limit as 128M by default in common PHP configuration references [source: PHP Manual].

TLDR: PHP memory limit is the hard server-level cap, while WordPress memory constants are application-level requests. A WooCommerce store that fails during a 500-product import at 128M may run cleanly after PHP is raised to 256M and WordPress admin memory is set to 256M. If the host caps PHP at 128M, a WordPress setting of 512M will not magically work. The practical fix is to raise PHP first, then match WordPress settings to that limit.

What the PHP memory limit actually controls

The PHP memory limit controls how much memory a single PHP process may use. That includes WordPress, plugins, themes, image processing, imports, backups, page builders, and background jobs.

When a script crosses the cap, PHP stops it and throws a fatal error. A common message looks like this:

Fatal error: Allowed memory size of 134217728 bytes exhausted…

That number equals 128 MB. It usually appears during heavy tasks, not on every page load. Product imports, media regeneration, large REST API requests, and backup plugins are usual suspects.

The PHP limit can be set in several places:

  • php.ini for server-wide or account-level PHP settings.
  • .user.ini on many shared hosts using PHP-FPM.
  • .htaccess on some Apache setups, if the host allows it.
  • Hosting control panels such as cPanel, Plesk, or custom dashboards.
  • PHP-FPM pool files on VPS or dedicated servers.
  • Container settings for Docker-based deployments.

The catch is that hosts often show one setting in a panel and enforce another behind it. It drives site administrators mad because a change may appear saved, yet errors keep showing up five seconds later during the same import task.

Computer screen displaying code and project files server configuration, timeout settings, performance metrics

What WordPress memory settings do

WordPress has its own memory constants. They are usually placed in wp-config.php. The two common ones are:

  • WP_MEMORY_LIMIT for the front end and normal WordPress runtime.
  • WP_MAX_MEMORY_LIMIT for admin screens and heavier backend tasks.

A typical setup looks like this:

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

WordPress uses these constants to ask PHP for more memory through runtime configuration. WordPress documents these constants for increasing memory available to PHP during WordPress execution [source: WordPress Developer Resources].

Still, WordPress cannot break the server’s PHP cap. If PHP is locked at 128M, setting WP_MEMORY_LIMIT to 512M may do little or nothing. The host wins.

PHP vs WordPress: the real difference

PHP memory limit is the foundation. It controls what the process may consume. WordPress memory settings sit above that. They tell WordPress how much memory it should try to use inside the allowed PHP boundary.

A simple way to read the hierarchy is:

  1. Server or hosting policy sets the top limit.
  2. PHP configuration applies the limit to PHP scripts.
  3. WordPress constants request memory inside WordPress.
  4. Plugins and themes consume that memory.

So, a WordPress setting is not a replacement for PHP configuration. It is a WordPress-side request. That distinction matters when a site owner is trying to fix crashes without guessing.

a blue and white wordpress logo wordpress settings, php limit, memory hierarchy

Recommended memory values

There is no perfect number for every site. A small brochure site may run fine on 128M. A normal business site with a page builder often feels better at 256M. A WooCommerce shop with imports, subscriptions, filters, and analytics may need 512M for admin tasks.

Common starting points are:

  • 128M: Small WordPress site, few plugins, light theme.
  • 256M: Typical business site, page builder, SEO plugin, forms.
  • 512M: WooCommerce, LMS, membership site, heavy imports.
  • 768M or more: Rare cases, usually tied to bad plugins, huge datasets, or inefficient jobs.

Higher is not always better. A bloated plugin can eat 512M and still crash. More memory may hide the real issue. It should buy stability, not excuse wasteful code.

How a site owner should configure memory

The clean approach starts with PHP. The site owner, developer, or host should confirm the active PHP memory limit first. This can be checked through hosting tools, Site Health in WordPress, a phpinfo() file, or command-line PHP.

After that, the PHP limit should be raised. On shared hosting, the control panel is usually the safest route. On managed WordPress hosting, support may need to change it. On a VPS, the administrator can edit PHP-FPM or the relevant PHP configuration file.

Then WordPress can be matched in wp-config.php:

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

These lines should appear above:

/* That's all, stop editing! Happy publishing. */

Honestly, it feels like this should be clearer inside WordPress itself. A site can show “memory increased” in one place while the real PHP cap still blocks heavy tasks elsewhere.

Common mistakes that waste time

  • Changing only WordPress: This fails when PHP is capped by the host.
  • Editing the wrong php.ini: Servers can run different PHP versions for CLI and web requests.
  • Using .htaccess on PHP-FPM: Many PHP-FPM setups ignore PHP memory rules in .htaccess.
  • Setting memory too high: A huge limit can let one bad process hurt the whole server.
  • Ignoring plugin behavior: Backups, scans, imports, and image tools can spike memory hard.
turned-on monitor website error, memory exhausted, wordpress admin

Best practice for stable sites

A healthy WordPress site should run with enough memory for peak tasks, not just homepage visits. The PHP limit should be set high enough for expected workloads. WordPress constants should then reflect that plan.

For many sites, PHP at 256M, WP_MEMORY_LIMIT at 256M, and WP_MAX_MEMORY_LIMIT at 512M is a practical setup. Busy stores may need more during imports or batch processing. If memory errors continue after that, the next step is profiling plugins, theme code, database queries, and cron jobs.

The core rule is blunt: PHP sets the ceiling. WordPress asks to use space under that ceiling. Once that is clear, memory errors become much easier to diagnose.

FAQ

What is the difference between PHP memory limit and WordPress memory limit?

PHP memory limit is the server-level cap for each PHP process. WordPress memory limit is an application-level setting that requests memory for WordPress. WordPress cannot exceed the PHP or hosting cap.

Can WordPress increase memory without changing PHP?

Sometimes, but only if the host allows runtime changes. If the server blocks higher values, WordPress settings in wp-config.php will not override that block.

Is 256M enough for WordPress?

For many business sites, 256M is enough. WooCommerce, LMS, membership, and import-heavy sites may need 512M for admin tasks.

Where should memory be changed first?

It should be changed at the PHP or hosting level first. After that, WordPress constants can be added or adjusted to match the available limit.

Will increasing memory make a slow site faster?

Not always. It may stop crashes during heavy tasks, but speed problems often come from slow queries, large plugins, poor hosting, missing cache, or oversized media.

You cannot copy content of this page