How to increase php memory limit?

Henry Blake
Getting that dreaded “Fatal error: Allowed memory size exhausted” message? WordPress plugins eating through memory like candy? Don’t panic - CloudLinux gives you complete control over PHP memory limits for each domain.
Most hosting providers lock you into their default 128MB limit, but that’s rarely enough for modern WordPress sites running multiple plugins, page builders, or processing large images. Here’s how to fix it properly.
- Login to cPanel for the affected domain (not your main WHM account)
- Find “Select PHP Version” in the Software section - it’s usually near the top
- Switch away from native PHP - pick any other version (7.4, 8.0, 8.1, etc.) and click “Set as Current”
- Click “Switch to PHP Settings” - this button appears in the top-right after step 3
- Locate memory_limit in the list and click the current value (usually 128M)
- Set your new limit - start with 256M for most WordPress sites, 512M for heavy themes
- Hit Apply, then Save - both buttons are important
Here’s what different sites typically need:
- Basic WordPress: 256M
- WooCommerce stores: 512M
- Page builders (Elementor/Divi): 512M-1024M
- Image processing sites: 1024M+
Don’t just jump to 2048M - start conservatively and increase if needed. Excessive memory allocation can actually slow things down.
Common issues and fixes:
Still getting memory errors after increasing the limit? The actual problem might be something else entirely. Sometimes plugins get stuck in infinite loops or load massive datasets unnecessarily. Deactivate plugins one by one to find the culprit. That gallery plugin loading 500 images at once? That’s your problem right there.
Can’t find “Select PHP Version” in your cPanel? Your account might still be on native PHP. Just contact support - we’ll enable PHP selector for your account. Takes about 5 minutes to fix.
Made the changes but nothing happened? Clear any caching plugins first. Also check if your theme has hardcoded memory settings in wp-config.php - those override everything else. Look for lines like define(‘WP_MEMORY_LIMIT’, ‘128M’) and update them to match your new setting.