You’ve finally installed that shiny new plugin or customized your theme-then boom. A white screen. Or worse, a cryptic message saying “Allowed memory size of x bytes exhausted.” Sounds familiar? You’re not alone. This memory limit error is one of the most frustrating issues WordPress users face, especially those running media-heavy sites, plugins, or custom themes.
Let’s break down what this error actually means and how to resolve it with confidence-step-by-step. No guesswork. No panic. Just real fixes.
What Is a WordPress Memory Limit Error?
Before diving into solutions, it’s crucial to understand the root cause. WordPress, like any PHP-based application, relies on server memory to run scripts. Each site is allocated a specific amount of memory (typically 64MB to 128MB by default). When your site tries to use more than this, PHP throws a fatal error like:
Fatal error: Allowed memory size of 67108864 bytes exhausted
This usually happens during plugin installation, media uploads, WooCommerce store operations, or theme customizations.
1. Check Current WordPress Memory Limit
Knowing your site’s current memory allocation is the first step.
How to Check:
- Navigate to Tools > Site Health > Info in your WordPress dashboard.
- Scroll to the Server section.
- Look for
PHP memory limit
.
If it’s 64MB or 128MB, there’s a good chance you’re hitting the upper threshold during operations.
Alternatively, create a simple PHP file with this code and upload it to your root directory:
<?php phpinfo(); ?>
Then visit yoursite.com/phpinfo.php
in a browser and search for “memory_limit.”
2. Increase Memory Limit via wp-config.php
This is the most common and often the quickest fix.
Steps to Follow:
Access your site via FTP or cPanel File Manager.
Locate your wp-config.php
file in the root directory.
Just before the line that says /* That's all, stop editing! */,
add:
define('WP_MEMORY_LIMIT', '256M');
This tells WordPress to use up to 256MB of memory. For most sites, this is sufficient.
Note: If your hosting provider has strict limitations, this line alone may not work. You may need to modify other files (explained next).
3. Modify php.ini File (If Your Host Allows It)
Some hosting environments allow users to override PHP settings via a php.ini
file.
Steps to Try:
- Go to your root or /wp-admin/ directory.
- Create or edit a file named
php.ini
. - Add or edit this line:
`memory_limit = 256M`
This method directly affects PHP’s memory allocation server-side. It’s more robust than the wp-config method, especially for complex sites or WooCommerce stores.
Hosting Note: Shared hosting plans often ignore custom php.ini files. In that case, try the next solution.
4. Use .htaccess to Override PHP Limits (For Apache Servers)
If php.ini
isn't effective or allowed, .htaccess
might do the trick.
Edit Your .htaccess File:
- Locate your .
htaccess file
(you may need to enable hidden files in cPanel). - Add this line at the top or near existing PHP values:
php_value memory_limit 256M
Be cautious when editing .htaccess
. A small syntax error can crash your site. Always back up before making changes.
5. Contact Your Hosting Provider
If none of the above methods work, your hosting provider may have hard-coded memory limits that only they can change.
What to Ask:
- Request to increase your PHP memory limit to 256MB or more.
- Ask whether you can have a dedicated
php.ini
or access to custom memory settings.
Some managed WordPress hosting services, like Kinsta or WP Engine, restrict user-level control but offer fast support and memory upgrades upon request.
6. Optimize Your WordPress Environment
Sometimes, it’s not just about increasing the limit-it’s about reducing memory usage. Bloated plugins and themes can hog resources even when inactive.
Optimization Tips:
- Deactivate unused plugins.
- Switch to a lightweight theme like Astra or GeneratePress.
- Install performance monitoring tools like Query Monitor to catch memory-heavy processes.
- Use a caching plugin (e.g., WP Rocket or W3 Total Cache).
Cleaning up your WordPress setup can reduce the need for higher memory limits and improve site speed.
7. Upgrade to a Better Hosting Plan
If you’re consistently hitting memory ceilings, your current hosting plan might not be cutting it. Shared hosting has strict limits to prevent one site from consuming all server resources.
** When to Consider an Upgrade**:
- Running an eCommerce store or membership site.
- Heavy use of page builders like Elementor.
- Handling large volumes of media.
Upgrading to VPS, cloud hosting, or managed WordPress hosting gives you more memory, CPU, and flexibility.
8. Debugging: When the Error Persists
Let’s face it, sometimes even after increasing the memory limit, the error lingers. It could be a plugin conflict or a poorly coded theme.
How to Debug:
Enable WP_DEBUG in your wp-config.php
:
define('WP_DEBUG', true);
- This logs PHP errors in a file called debug.log in the /wp-content/ directory.
- Check the log to identify which plugin, function, or script is the culprit.
Once identified, disable the plugin or reach out to the developer.
Final Thoughts (No Fluff)
Memory limit errors are frustrating-but they’re also highly fixable. Whether you choose a quick config tweak or a deeper server-level adjustment, there’s a solution for every case.
If you’re short on time or confidence in handling technical configurations, don’t risk breaking your site.
Pro Tip
To hire WordPress developers in India, consider Invedus Outsourcing. You can handpick skilled developers based on your specific needs-whether for troubleshooting, custom development, or ongoing site management. Visit the Invedus website and find the right expert for your business.
Read also : How to Recover a WordPress Website Without a Backup
Top comments (0)