How to Increase the PHP Memory Limit in cPanel

The PHP memory limit controls how much RAM a single PHP script is allowed to use. If WordPress shows "Allowed memory size of X bytes exhausted" or your site crashes during large operations (importing, exporting, running page builders), increasing this limit usually resolves it.

Still hitting memory errors after increasing the limit?

Our team can review your PHP configuration and hosting plan. Contact support →


Method 1 — via cPanel MultiPHP INI Editor (Recommended)

  1. Log in to cPanel.
  2. Go to Software → MultiPHP INI Editor.
  3. Select the Basic Mode tab.
  4. Choose your domain from the dropdown at the top.
  5. Find memory_limit and set it to 256M (or higher if needed — 512M for heavy WooCommerce stores).
  6. Click Apply.

This is the most reliable method as it uses cPanel's built-in PHP configuration tools and survives server updates.


Method 2 — via wp-config.php (WordPress Only)

  1. In cPanel File Manager, navigate to public_html and open wp-config.php.
  2. Add the following line before the line that says /* That's all, stop editing! */:
define( 'WP_MEMORY_LIMIT', '256M' );
  1. Save the file.

This sets WordPress's own memory allocation, which may be lower than the PHP limit even if the PHP limit is already high.


Method 3 — via .htaccess

  1. In File Manager, open public_html/.htaccess (enable Show Hidden Files if needed).
  2. Add this line at the top of the file:
php_value memory_limit 256M
  1. Save the file.

Note: This method only works on Apache servers with PHP running as a module. It will show a 500 error on LiteSpeed or Nginx servers — if that happens, remove the line and use Method 1 instead.


How to Verify the New Limit

  1. Create a temporary file in your public_html folder called phpinfo.php.
  2. Add this content: <?php phpinfo(); ?>
  3. Visit yourdomain.co.uk/phpinfo.php in your browser.
  4. Search for memory_limit — the value shown should match what you set.
  5. Delete the file after checking — leaving phpinfo.php publicly accessible is a security risk.

Recommended Memory Limits

  • Standard WordPress site: 128M–256M
  • WooCommerce store: 256M–512M
  • Heavy page builders (Elementor, Divi): 512M
  • Large imports / database operations: 512M–1024M (temporary)

Related Articles

Repeatedly hitting memory limits?

You may need a hosting upgrade. Our team can advise on the right plan for your site. Talk to us →

?האם התשובה שקיבלתם הייתה מועילה 0 משתמשים שמצאו מאמר זה מועיל (0 הצבעות)