# Understanding PHP memory limits
Source: https://docs.webgee.com/en/development/understanding-php-memory-limits-in-shared-hosting-environments



`memory_limit` caps how much memory a single PHP script may allocate. Applies to
shared, reseller and Premium hosting.

The default in **Select PHP Version** is deliberately lower than the maximum
available.

## Why the default is conservative [#why-the-default-is-conservative]

The limit is a safeguard. Without it, one runaway script — an infinite loop, an
unbounded query result — allocates until the server has nothing left, taking down
every account on it.

A conservative default is sufficient for the great majority of sites, and it
means a fault in one script stays contained.

## Raising it [#raising-it]

**cPanel → Select PHP Version → Options** — see
[Change your PHP version and settings](/en/development/change-php-version).

Reasonable reasons to raise it:

* Importing a large file or database through a web interface
* Image processing on large uploads
* A WooCommerce store with a big catalogue
* An application that documents a higher requirement

<Callout type="warn">
  Raising `memory_limit` does not raise your **account's** memory limit. That is
  set by your plan, and it is what produces 503 errors — see
  [CloudLinux and LVE limits explained](/en/performance/understanding-cloudlinux-and-lve-limits-enhancing-server-stability-and-performan).

  Setting `memory_limit` above your account's allocation achieves nothing: the
  script is killed at the account limit regardless.
</Callout>

## When raising it is the wrong answer [#when-raising-it-is-the-wrong-answer]

<Callout type="info">
  A normal page load should not need hundreds of megabytes. WordPress serving a
  page comfortably fits in 128–256 MB. If a site needs 1 GB to load its homepage,
  the limit is not the problem — something is loading far more than it should.
</Callout>

Usual causes:

* **A plugin querying without limits**, loading an entire table into memory
* **An unbounded loop** accumulating data
* **Image processing on every request** rather than once at upload

Trace it before raising anything —
[PHP X-Ray](/en/performance/diagnose-slow-site-php-xray) shows where the work is
going. Raising the limit hides the symptom, and the underlying problem consumes
your account's CPU and entry processes as well.

## Resellers [#resellers]

Resellers cannot raise the **default** applied to new accounts — that is set
server-side. Individual accounts can be changed within their allocation as above,
and Resource Boost+ raises the ceiling for one account.

## Check what is actually applied [#check-what-is-actually-applied]

```php
<?php echo ini_get('memory_limit');
```

Delete the file afterwards. On Bolt-Cache, the PHP Selector is ignored entirely
and the value comes from `.user.ini` — see
[Change your PHP version and settings](/en/development/change-php-version).

## Related [#related]

* [Diagnose a PHP 500 error](/en/development/php-500-errors-and-how-to-resolve-them)
* [Magento reports the wrong memory limit](/en/development/magento-showing-incorrect-memory-limit)
