Increase PHP Memory Limit in cPanel

When do I need to increase PHP memory?

If you see errors like Fatal error: Allowed memory size exhausted or your WordPress shows a white screen, it's likely you need more PHP memory. This often occurs with complex sites, heavy plugins, or WooCommerce stores with many products.

Method 1 — From the PHP Selector in cPanel (recommended)

  1. Log in to cPanel
  2. Look for the "Software" section
  3. Click on "Select PHP Version"
  4. Click on the "PHP Options" tab
  5. Find memory_limit and change the value. We recommend 256M or 512M
  6. Click on "Save"

Method 2 — From the .htaccess file

Add this line to your .htaccess file inside public_html:

php_value memory_limit 256M

Method 3 — From wp-config.php (WordPress)

Open the wp-config.php file and add before the line /* That's all, stop editing! */:

define('WP_MEMORY_LIMIT', '256M');
✅ Recommended values:
Simple blog: 128M
WordPress with plugins: 256M
WooCommerce / store: 512M