Skip to content

PHP memory limit (memory_limit)

The PHP memory limit is the most memory PHP may use for a single request: building one page, handling one upload, running one background task. It’s a ceiling, not the memory your site actually uses, and not the memory of the whole server.

When a request needs more memory than the limit allows, PHP stops it on the spot. Depending on where that happens, visitors see an error page or a blank screen, an upload or import breaks off, or an update doesn’t finish. The error log then shows “Allowed memory size of … bytes exhausted”.

A higher limit isn’t a reservation. Each request takes only what it needs, and many requests can run at the same time, each with the same ceiling. The limit protects the server from a single request using up all its memory.

Server: The hosting provider sets the limit in PHP’s configuration and decides whether sites may raise it. On some plans, the limit is fixed; since PHP 8.5, the provider can also set an upper bound that no site can go beyond.

WordPress: WordPress raises the limit for itself if PHP allows it. For normal requests, it uses the value of WP_MEMORY_LIMIT; for the admin area, image processing and scheduled tasks, it raises it further to WP_MAX_MEMORY_LIMIT. Both can be set in wp-config.php. WordPress never lowers a limit that’s already higher. Plugins can raise the limit for their own tasks as well.

How close a request comes to the limit depends on what it does. Page builders, imports, backups and the processing of large photos need the most memory.

The PHP memory card is in System info, tab Server & System, under PHP. It compares the memory PHP used at Permo’s last check with the limit, as a share and as a bar with both amounts:

  • Green below 80% of the limit.
  • Yellow from 80%.
  • Red above 90%.

Without a limit, the card shows the memory used, with No limit set. When PHP keeps coming that close to its limit, the Dashboard lists The server is often overloaded under Needs attention (see notifications). Under Changes, System info records when the limit changes.

Permo records the limit that applies in the request that carries out the check, after WordPress has applied WP_MEMORY_LIMIT. A limit of -1 appears as “unlimited”. When WP-Cron starts the run through a web request, Permo records the limit before the increase that wp-cron.php applies since WordPress 6.3.

Permo also records how much memory is in use at the start of the run; see PHP memory usage.

Sources