Learn how to increase WordPress memory limit using wp-config.php, PHP.ini, .htaccess, cPanel, and hosting settings to fix memory errors.
Increase WordPress Memory Limit
If your WordPress website displays the “Allowed memory size exhausted” error, runs slowly, or crashes while installing plugins or importing large files, it’s time to increase WordPress memory limit.
WordPress uses PHP memory to process plugins, themes, media uploads, WooCommerce stores, and page builders like Elementor. When your website reaches the allocated memory limit, it cannot complete requests and starts throwing fatal errors.
In this guide, you’ll learn multiple methods to safely increase the WordPress memory limit, troubleshoot common issues, and choose the right memory size for your website.
What Is WordPress Memory Limit?
The WordPress memory limit is the maximum amount of server RAM that PHP allows WordPress to use while executing scripts.
It helps prevent one website from consuming all server resources.
Common default values include:
| Website Type | Recommended Memory |
|---|---|
| Simple Blog | 128 MB |
| Business Website | 256 MB |
| WooCommerce Store | 256–512 MB |
| Elementor Website | 512 MB |
| Membership/LMS Site | 512 MB |
| Large WooCommerce Store | 768 MB–1 GB |
Signs You Need to Increase WordPress Memory Limit
You should increase the memory limit if you notice:
- Allowed memory size exhausted error
- White Screen of Death
- Elementor won’t load
- WordPress updates fail
- Plugin installation errors
- Image optimization fails
- WooCommerce checkout crashes
- Backup plugins stop midway
- Website becomes slow in wp-admin
- Random fatal PHP errors
Method 1: Increase WordPress Memory Limit Using wp-config.php
This is the easiest and most common method.
Open your site’s wp-config.php file.
Find:
/* That's all, stop editing! Happy publishing. */
Add this line just above it:
define('WP_MEMORY_LIMIT', '256M');
For larger websites:
define('WP_MEMORY_LIMIT', '512M');
Method 2: Increase PHP Memory Limit in php.ini
If your hosting allows custom PHP settings, edit php.ini.
Add:
memory_limit = 512M
Save the file and restart PHP if required.
Method 3: Increase Memory Limit Using .htaccess
Some Apache servers allow increasing PHP memory through .htaccess.
Add:
php_value memory_limit 512M
If your site shows a 500 Internal Server Error after adding this line, remove it because your hosting doesn’t support this method.
Method 4: Increase Memory Limit from cPanel
Many hosting companies allow changing PHP settings directly.
Steps:
- Login to cPanel.
- Open MultiPHP INI Editor or Select PHP Version.
- Find memory_limit.
- Change it to:
512M
- Save changes.
Method 5: Increase Memory Limit in Plesk
If your server uses Plesk:
- Login to Plesk.
- Go to Websites & Domains.
- Select PHP Settings.
- Locate:
memory_limit
- Change it to:
512M
Save the settings.
Method 6: Increase Memory Limit via Hosting Dashboard
Some managed WordPress hosts let you adjust PHP settings without editing files.
Typical locations include:
- PHP Configuration
- PHP Settings
- Server Settings
- Advanced PHP
Increase:
memory_limit = 512M
Method 7: Ask Your Hosting Provider
Some shared hosting providers lock PHP memory settings.
If none of the previous methods work, contact support and request:
Please increase my PHP memory limit to 512 MB.
How to Check Current WordPress Memory Limit
There are several ways to verify the current limit.
Method 1: Site Health
Go to:
Tools → Site Health → Info → Server
Look for:
PHP Memory Limit
Method 2: phpinfo()
Create:
<?php
phpinfo();
?>
Open it in your browser and search for:
memory_limit
Method 3: WordPress Plugins
Plugins like:
- Site Health
- Query Monitor
- WP-ServerInfo
can display the current PHP memory limit.
Recommended Memory Limits
| Website | Memory Limit |
|---|---|
| Personal Blog | 128 MB |
| Small Business | 256 MB |
| WooCommerce | 512 MB |
| Elementor Pro | 512 MB |
| LMS Website | 512 MB |
| Large Marketplace | 768 MB–1 GB |
Difference Between WP_MEMORY_LIMIT and PHP memory_limit
Many beginners confuse these settings.
| WP_MEMORY_LIMIT | PHP memory_limit |
|---|---|
| WordPress setting | PHP server setting |
| Cannot exceed PHP limit | Server maximum |
| Set inside wp-config.php | Set in php.ini or hosting panel |
If PHP allows only 256 MB, WordPress cannot use 512 MB.
Why Memory Limit Doesn’t Change
If the memory remains unchanged after editing files, possible reasons include:
- Hosting restricts PHP settings.
- Wrong php.ini file edited.
- Server cache needs clearing.
- PHP-FPM needs restarting.
- Another configuration overrides your changes.
- Managed hosting locks PHP values.
Common Errors Fixed by Increasing Memory Limit
Increasing the memory limit often resolves:
- Allowed memory size exhausted
- Fatal PHP errors
- White Screen of Death
- Elementor loading issues
- WooCommerce checkout failures
- Plugin update failures
- Theme installation errors
- Import/export failures
- Backup interruptions
Best Practices
To avoid memory-related issues:
- Keep WordPress updated.
- Remove unused plugins.
- Delete inactive themes.
- Optimize your database.
- Use a quality hosting provider.
- Avoid poorly coded plugins.
- Update PHP to the latest supported version.
- Enable object caching if available.
- Monitor memory usage regularly.
Frequently Asked Questions
What is the best WordPress memory limit?
Most websites run well with 256 MB, while WooCommerce and Elementor sites typically benefit from 512 MB.
Is increasing the memory limit safe?
Yes. Increasing it within your hosting plan’s limits is completely safe.
Can I set the memory limit to 1024 MB?
Yes, but only if your server has sufficient RAM and your hosting provider allows it.
Does increasing memory make WordPress faster?
It doesn’t directly speed up WordPress, but it prevents crashes and allows resource-intensive tasks to complete successfully.
Why do I still get memory errors after increasing the limit?
Your hosting provider may enforce a lower PHP memory limit, or a plugin may be consuming excessive memory.
Common Memory Errors and Solutions
| Error | Solution |
|---|---|
| Allowed memory size exhausted | Increase PHP memory limit |
| Elementor stuck loading | Raise memory to 512 MB |
| WooCommerce timeout | Increase memory and optimize plugins |
| White Screen of Death | Increase memory and disable faulty plugins |
| Import failed | Raise PHP memory and execution time |
Conclusion
Knowing how to increase WordPress memory limit is essential for maintaining a stable and high-performing website. Whether you edit wp-config.php, php.ini, .htaccess, or use your hosting control panel, increasing the available PHP memory can resolve many common WordPress issues, including fatal errors, plugin failures, and Elementor crashes.
For most websites, 256 MB is sufficient, while WooCommerce stores, Elementor-powered sites, and resource-intensive applications should consider 512 MB for smoother performance. If your hosting provider prevents you from changing the limit, contact their support team or upgrade to a hosting plan with higher PHP resources.
External Resources
| Resource | Purpose |
|---|---|
| https://wordpress.org/support/article/editing-wp-config-php/ | Editing wp-config.php |
| https://developer.wordpress.org/advanced-administration/ | WordPress administration |
| https://www.php.net/manual/en/ini.core.php | PHP memory_limit documentation |
| https://developer.wordpress.org/apis/ | WordPress developer resources |
| https://wordpress.org/support/ | WordPress support forums |







