How to increase the PHP memory limit in WordPress

How to increase the PHP memory limit in WordPress

If you see "Allowed memory size exhausted", WordPress needs more PHP memory.

Step 1: Raise PHP's limit

  1. In cPanel, open MultiPHP INI Editor in the Software section.
  2. Choose your domain.
  3. Set memory_limit to 256M (or 512M for heavy sites) and click Apply.

Step 2: Tell WordPress

Edit wp-config.php and add this line above /* That's all, stop editing! */:

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

Check it worked

Go to Tools › Site Health › Info › Server and look at the PHP memory limit.

Note: your hosting account also has an overall memory limit (see How to understand resource limits). If a site needs more than that, find out which plugin is using so much memory or consider a larger package.

    • Related Articles

    • How to fix a slow WordPress admin area

      Common fixes Update PHP to a current version (see How to change PHP version). This alone often gives the biggest improvement. Remove unused plugins. Deactivating isn't enough; delete them. Find heavy plugins with Query Monitor, which shows how many ...
    • How to change PHP version in cPanel

      Log in to cPanel and open MultiPHP Manager in the Software section. Tick the domain(s) you want to change. Choose the PHP version from the drop-down menu on the right and click Apply. The change takes effect immediately and only for the domains you ...
    • How to check PHP settings with phpinfo

      A phpinfo page shows the PHP version and settings your site is actually using. In cPanel File Manager, open public_html (or the folder for the domain you're checking). Click + File, name it something hard to guess such as info-82731.php, and create ...
    • PHP mail() vs SMTP: what's the difference?

      Websites can send email (contact forms, order confirmations, password resets) in two ways. PHP mail() The website hands the message straight to the server's mail system. It's simple, but the email isn't tied to a real mailbox and isn't authenticated, ...
    • How to reset your WordPress password

      Option 1: Lost password link Go to yourdomain.co.uk/wp-login.php and click Lost your password? Enter your username or email address. Follow the link in the email to set a new password. If the email doesn't arrive, check spam, then try one of the ...