Free migrationUK web hosting from £2.99 a month, with backups every six hours and a 60-day money-back guarantee.UK web hosting from £2.99 a month.See hosting plans

How to increase the WordPress memory limit

On this page

This guide shows how to give WordPress more memory when you see “Allowed memory size exhausted” or a plugin asks for a higher limit.

How the two limits work

There are two settings, and both matter:

  • PHP memory_limit is the most memory one PHP process can use. It is set for your account in cPanel.
  • WP_MEMORY_LIMIT is how much of that WordPress asks for. It is set in wp-config.php.

WordPress can’t use more than PHP allows, so if you raise one, check the other.

Raise the PHP memory limit in cPanel

  1. Log in to cPanel.
  2. Open Select PHP Version, then click the Options tab. On some accounts this is called MultiPHP INI Editor instead. The wording may vary.
  3. Find memory_limit.
  4. Choose a higher value, such as 256M or 512M.
  5. The change saves automatically in Options. In MultiPHP INI Editor, pick your domain first and click Apply after changing the value.

Raise the WordPress memory limit

  1. In cPanel, open File Manager.
  2. Go to your WordPress folder (usually public_html).
  3. Right-click wp-config.php and choose Edit.
  4. Add these lines above the line that says “That’s all, stop editing!”:
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );
  1. Save the file.

WP_MEMORY_LIMIT covers the front of your site. WP_MAX_MEMORY_LIMIT covers the dashboard, which sometimes needs more for jobs like resizing images. If either line is already in the file, change the number rather than adding it twice.

Check it worked

In WordPress, go to Tools, then Site Health, then the Info tab. Open the Server section to see the PHP memory limit, and WordPress Constants to see WP_MEMORY_LIMIT.

If it doesn’t work

  • The new value doesn’t show. Check the PHP version you edited is the one your site uses. See how to change your PHP version.
  • You still get memory errors at 512M. A plugin or theme is probably stuck in a loop or doing too much at once. Turn plugins off one by one to find it. See how to fix the white screen of death.
  • The site breaks after editing wp-config.php. Check for a missing quote or semicolon, or remove the lines you added.

Good to know

Our hosting accounts have 4 GB of RAM in total. The PHP memory_limit applies to each PHP process, not to your whole account, so several visitors at once each get their own share. Setting it very high doesn’t make a site faster. Most WordPress sites run well on 256M. For speed, see how to make WordPress faster.

Still stuck? Open a support ticket and we’ll help.

Still stuck? Open a support ticket from your client area. Tell us your domain and which step went wrong, and we'll take it from there.
WordPress hosting from £2.99 a month

WP Toolkit, staging, backups every six hours and free migration of your site.

See WordPress hosting
Open in new tab