Table of Contents
If you are seeing this, your first reaction is probably panic. Take a deep breath. This is one of the most common issues WordPress users face, and it is completely fixable. This error is not a sign that your site is broken forever. It is simply a sign that your website’s needs have outgrown its currently assigned resources.
This guide is your complete resource for understanding and fixing this error for good. We will walk you through what this “memory limit” is, why it happens, and several step-by-step methods to fix it. We will also explore the deeper, long-term solutions that separate amateur site managers from professional web creators.
Key Takeaways
- The Error Is a Resource Cap: The “Fatal error: Allowed memory size exhausted” message simply means a script (usually a plugin or theme) needed more “RAM” (PHP memory) than your server was allowed to give it.
- Check First, Edit Second: Before you change anything, you must check your current limit. The easiest and safest way is to use the built-in WordPress Site Health tool (Tools > Site Health > Info > Server) or, if you are an Elementor user, the Elementor > System Info screen.
- The Quick Fix: The most common way to fix this is by adding define(‘WP_MEMORY_LIMIT’, ‘256M’); to your wp-config.php file. We will show you how to do this safely.
- The Real Fix: Your hosting provider often sets a “hard cap” on memory. If editing your files does not work, the fastest solution is often a simple call or live chat with your host asking them to raise the PHP memory_limit for your account.
- The Proactive Solution: This error is often a symptom of a fragmented website. Using a high-performance, integrated ecosystem like Elementor Hosting with the Hello Theme and Elementor Pro prevents these issues by providing optimized, ample resources from the start.
What Is the WordPress Memory Limit? (The “What”)
To understand the fix, you first need to understand the problem. Every website runs on a computer called a server. Like your personal computer, that server has a finite amount of resources, including memory (RAM).
When someone visits your website, your server runs PHP, the programming language WordPress is built on. This process executes your theme’s functions, runs your plugins, and pulls your content from the database to build the webpage and send it to the visitor’s browser.
All of this work takes memory.
The PHP memory limit is a safety valve. Your hosting provider sets this limit to prevent a single website (or a runaway script on that site) from using 100% of the server’s memory and crashing every other site, including its own.
WP_MEMORY_LIMIT vs. PHP memory_limit
This is a critical distinction that confuses many users.
- memory_limit (The Server Limit): This is the “true” limit. It is the master setting in the server’s main php.ini file. Your hosting provider controls this. If this limit is 128M, you can never use more than 128M, no matter what you do.
- WP_MEMORY_LIMIT (The WordPress Limit): This is a WordPress-specific setting in your wp-config.php file. By default, WordPress will try to use up to 40M for a single site (or 64M for a multisite installation).
When you define WP_MEMORY_LIMIT in your wp-config.php file, you are telling WordPress, “Please try to use this much memory if you need it.”
Here is the key: WP_MEMORY_LIMIT cannot override memory_limit.
If your server’s memory_limit is 128M and you set define(‘WP_MEMORY_LIMIT’, ‘256M’);, WordPress will still only be able to use 128M. This is why, for many users, editing the wp-config.php file alone does not solve the problem.
Why Does This “Fatal Error” Happen? (The “Why”)
The error is triggered because a specific PHP script or process on your site tried to cross the memory threshold. This is rarely caused by WordPress core. The culprits are almost always plugins or your theme.
- Heavy Plugins: This is the most common reason. Powerful plugins that do heavy lifting require more memory. The top contender is Elementor’s WooCommerce Builder, which is a fantastic tool. Why? Because WooCommerce itself is a complex, powerful application. Running an online store is not like running a simple blog. It manages products, customer data, payment gateways, and inventory. This legitimately requires more memory.
- “Mega-Themes”: Many themes purchased from marketplaces come bundled with dozens of features, 10 different slider plugins, and complex page builders. This “bloat” consumes a significant amount of memory just to load, even if you are not using 90% of the features.
- Complex Page Builders: Powerful, professional tools like Elementor allow you to create stunning, complex designs. These designs, with many elements, widgets, and custom code, naturally require more memory to render than a simple, text-based blog post. This is not a bug. It is a sign of a powerful tool.
- Poorly Coded Plugins: Sometimes, a plugin (often a free, not-well-maintained one) has a “memory leak.” This is a bug in its code that causes it to use more and more memory until it hits the limit and crashes.
- Plugin Conflicts: You might have two plugins that work fine on their own, but they conflict with each other, creating an infinite loop or a process that eats up all your memory.
- Processing Large Files: Plugins that edit images (like the Elementor Image Optimizer) or handle large backups can temporarily spike memory usage during their process.
Here is a helpful video from the Elementor team on how to use their WooCommerce Builder. You can see how many powerful features are at play, which helps explain why a healthy memory limit is so important.
Before You Edit: Essential First Steps
Before you touch a single line of code, you must do these three things. This is a professional best practice.
Step 1: Back Up Your Website
I cannot say this strongly enough: Do not edit core files without a complete, recent backup.
You are about to edit files that run your entire website. A single typo or misplaced character can lock you out of your site.
- Host Backup: The best and easiest option. Most quality hosts (including Elementor Hosting) take automatic daily backups. You can often create a “snapshot” backup with one click from your hosting dashboard.
- Plugin Backup: If your host does not offer this, use a plugin like UpdraftPlus or WPvivid. Download the backup files to your local computer before you proceed.
Step 2: Prepare to Access Your Site’s Files
You will need to access and edit files on your server. You have two main options.
- cPanel File Manager: If your host uses cPanel, you can log in to your hosting account and find the “File Manager” tool. This gives you a web-based interface to see and edit your files. It is quick and easy. * FTP Client: This is the more traditional, robust method. An FTP (File Transfer Protocol) client is a free application for your computer (like FileZilla) that connects directly to your server’s file system. Your host will provide you with your FTP “credentials” (host, username, password).
Step 3: Check Your Current Memory Limit
Why fly blind? You must find out what your current PHP memory_limit is. There are two easy, safe ways to do this.
The WordPress Way (Good):
- Log in to your WordPress dashboard.
- Go to Tools > Site Health.
- Click the Info tab.
- Expand the Server section.
- Look for the “PHP memory limit” line. This is your “true” server-side limit.
The Elementor Way (Better): If you are an Elementor user, the team has made this even easier.
- Log in to your WordPress dashboard.
- Go to Elementor > System Info.
- Look for the “Memory Limit” line under “Server Environment.”
- You will also see the “WP Memory Limit” line. This is the perfect place to see the difference between the two settings we discussed earlier.
Now that you have a backup and you know your starting limit, you are ready to fix the problem.
How to Increase the WordPress Memory Limit (The 3 Methods)
We will start with the most common method and move to the most powerful. After making any of these changes, clear all caches (site, server, and browser) and then re-check your “Site Health” or “Elementor System Info” screen to see if your change was successful.
Method 1: Edit wp-config.php (The WordPress Way)
This is the “official” WordPress method. You are telling WordPress to request a higher memory limit.
- Log in to your server using FTP or cPanel File Manager.
- Navigate to the root folder of your WordPress installation. This is where you see folders like wp-admin, wp-content, and wp-includes.
- Find the file named wp-config.php.
- Important: Download a copy of this file to your computer as a backup before you edit it.
- Open the wp-config.php file to edit it.
- Scroll down to the bottom of the file until you see this line: /* That’s all, stop editing! Happy publishing. */
Just before that line, add the following code:
define(‘WP_MEMORY_LIMIT’, ‘256M’);
- Save the file and upload it back to your server, overwriting the original.
What does ‘256M’ mean? This sets the limit to 256 megabytes. For most modern websites running Elementor and a few other plugins, 256M is a healthy minimum. If you are running a heavy WooCommerce store, I strongly recommend setting this to 512M.
Method 2: Edit .htaccess (The Server Way)
If Method 1 does not work, it is likely because your host’s settings are overriding it. You can try to set the limit using the .htaccess file, which gives instructions directly to the server.
Note: This method will only work if your server runs on Apache. If your host uses Nginx (a common, high-performance alternative), this file will not work, and you should skip to Method 3.
- Log in to your server using FTP or cPanel File Manager.
- In your root folder, find the file named .htaccess.
- Note: Files starting with a dot (.) are often hidden. You may need to enable “Show Hidden Files” in your FTP client or File Manager.
- Download a backup of this file.
- Open the .htaccess file to edit it.
- Scroll to the very bottom of the file, after the </IfModule> tag.
Add the following line:
php_value memory_limit 256M
- Save the file and upload it back to your server.
Method 3: Edit php.ini (The Admin Way)
This is the most powerful and complex method. You are attempting to edit the server’s main configuration file for PHP. Your ability to do this depends entirely on your hosting plan.
- On Shared Hosting: You almost never have access to the main php.ini file. However, some hosts allow you to create a local php.ini file in your root folder.
- Create a new, blank text file on your computer.
- Name it php.ini.
- Add this single line to the file: memory_limit = 256M
- Upload this file to your WordPress root folder.
- On cPanel (The Easy Way): Many modern cPanel hosts have a tool for this.
- Log in to your cPanel.
- Look for a tool called “Multi-PHP INI Editor” or “Select PHP Version.”
- Select your domain.
- You will see a list of PHP settings. Find memory_limit and change the value in the dropdown or text box to 256M or 512M.
- Click “Apply” or “Save.” This is the best, safest way to do it if you have this tool.
- On a VPS/Dedicated Server: You have full control. You will need to SSH into your server and find the main php.ini file (e.g., in /etc/php/8.0/fpm/php.ini). Editing this is for advanced users, but if you are on a VPS, you likely already know how to do this.
What If None of Those Methods Work?
You have tried all three methods, you have cleared your cache, and your “Site Health” screen still shows a low memory limit (like 64M or 128M).
This is a very common scenario. It means your hosting provider is enforcing a hard cap at the server level. You cannot override their master setting.
The solution is simple:
- Go to your hosting provider’s website.
- Start a Live Chat or call their support line.
- Use this exact script: “Hi, I am running a WordPress website and I am getting a ‘fatal memory exhausted’ error. My current PHP memory_limit is set to [Your Current Limit]. Can you please increase it to 256M for my domain [[suspicious link removed]]?”
In 99% of cases, a good host will do this for you in less than five minutes. If they refuse, or if they want to charge you extra for it, this is a strong sign that you have outgrown your cheap hosting plan and it is time to move to a better provider.
The Deeper Problem: Why Is Your Site Using So Much Memory?
Increasing the memory limit is like finding a leak in your roof and putting a bigger bucket underneath it. It stops the water from spilling, but it does not fix the leak.
A professional web creator always investigates the cause of the high memory usage.
“Just increasing the memory limit is a temporary patch,” states web creation expert Itamar Haim. “A professional web creator always investigates why the memory is being used. Often, it’s a single, poorly-coded plugin that’s dragging down an otherwise fast website.”
You must find the “leaky” plugin.
How to Find the Culprit Plugin
The only way to do this reliably is with a plugin conflict test.
Warning: This will temporarily disable your site’s functionality. It is best to do this on a staging site. A staging site is a private clone of your website, and most quality hosts (including Elementor Hosting) provide a one-click staging feature.
If you do not have a staging site, you can do this on your live site, but be prepared for some downtime (do it at a low-traffic time).
- Backup Your Site: Yes, again.
- Go to Plugins > Installed Plugins.
- Select all plugins EXCEPT Elementor and Elementor Pro (if you use them).
- From the “Bulk actions” dropdown, select Deactivate and click “Apply.”
- Check your site. Is the error gone? If yes, the culprit is one of the plugins you just deactivated.
- Now, reactivate your plugins one by one.
- After each plugin you activate, go back and check your site. Use the pages that were giving you the error.
- When you reactivate a specific plugin and the error returns, you have found your problem.
Your options are to:
- Find a more lightweight, better-coded alternative plugin.
- Contact the plugin’s developer and show them the error.
- Decide if you really need that plugin’s functionality.
The “Elementor Way”: A Proactive Solution to Memory Problems
These memory errors are, at their core, a problem of fragmentation.
A typical WordPress site is a collection of parts from different vendors that were never designed to work together. You have a theme from “ThemeForest,” a builder (like Elementor), 20 different plugins from 20 different authors, and all of it is running on a generic, $5/month hosting plan. This is a recipe for conflicts and resource errors.
The “Elementor way” is to move from a fragmented setup to a holistic, integrated ecosystem.
Elementor is more than just a plugin. It is a complete Website Builder Platform that provides all the components you need, all designed to work together seamlessly.
- The Foundation: Elementor Hosting This is the single best way to prevent memory issues. Elementor Hosting is not generic hosting. It is a premium, managed environment built on the Google Cloud Platform, specifically optimized for Elementor. The memory limits are set high by default (512M or more) because the platform knows what a professional website needs. It eliminates the guesswork and the need to call support.
Check out this overview of Elementor’s integrated hosting solution:
https://www.youtube.com/watch?v=cmx5_uThbrM&pp=0gcJCcYJAYcqIYzv - The Canvas: Hello Theme Instead of using a bloated 50MB “mega-theme” that wastes memory, the professional standard is the Hello Theme. It is a minimal, ultra-lightweight “blank canvas” that provides only the essentials. This lets Elementor Pro’s Theme Builder take full control, ensuring that zero memory is wasted on theme features you are not using.
- The Tools: Elementor Pro & Ecosystem Plugins When you use Elementor Pro, you can often delete 5-10 other plugins. You get your form builder, popup builder, and custom code snippets all in one place. The same team built the Image Optimizer and the AI Site Planner. This integration means less overhead, fewer conflicts, and lower memory usage.
When you build on an integrated platform, you are not just fixing errors. You are preventing them from ever happening in the first place.
How Much Memory Is Enough? A Best-Practice Guide
The “right” memory limit depends entirely on your site’s complexity. Here are my professional recommendations.
| Site Type | Recommended PHP Memory Limit | Why? |
| Simple Blog | 128M | A simple blog with a few plugins does not do much heavy lifting. 128M is often fine. |
| Business/Portfolio Site | 256M | This is the new standard. With 10-20 plugins, a page builder, and a contact form, 256M gives you breathing room. |
| Elementor Site (Pro) | 256M (Minimum), 512M (Recommended) | A professional designer’s website uses powerful tools. Give your tools the resources they need to work properly. |
| WooCommerce Store | 512M (Minimum), 768M+ (Recommended) | This is non-negotiable. An eCommerce store is a complex application. 512M is the starting point. Large stores often run with 1G or more. |
| Large Community/LMS Site | 768M – 1024M+ | A site with memberships (BuddyPress) or online courses (LearnDash) is running constant, complex database queries. It needs significant resources. |
Conclusion: From Frustration to Freedom
That “fatal error” message is terrifying, but it is just a resource issue. You are now fully equipped to handle it.
You have learned how to check your current limit and how to safely edit wp-config.php, .htaccess, and php.ini to increase it. More importantly, you know that if those methods fail, the solution is a simple chat with your hosting provider.
But the biggest takeaway is this: A healthy website is not just about fixing errors. It is about building on a solid foundation. By auditing your plugins and choosing an integrated, high-performance platform like Elementor’s, you can stop being a “site janitor” who cleans up errors and start being a web creator who builds amazing experiences.
Frequently Asked Questions (FAQ)
1. What is the default WordPress memory limit? By default, WordPress attempts to set the limit to 40M for a single site and 64M for a multisite installation. This is almost always too low for a modern website.
2. Is WP_MEMORY_LIMIT the same as the PHP memory_limit? No. The PHP memory_limit is the “master” limit set by the server (your host). WP_MEMORY_LIMIT is a WordPress setting that requests a limit. WP_MEMORY_LIMIT can never be higher than the PHP memory_limit.
3. Will increasing my memory limit speed up my site? Not directly. Increasing the memory limit does not make your site faster. It simply prevents it from crashing. A higher limit gives complex tasks (like a WooCommerce checkout) the “room” they need to run to completion. Site speed is determined by other factors like good hosting, caching, and optimization.
4. I increased the limit in wp-config.php, but the error is still there. Why? This is the most common problem. It means your hosting provider has a lower “hard cap” set. For example, your WP_MEMORY_LIMIT is 256M, but your host’s PHP memory_limit is 128M. The server will always win. The solution is to contact your host and ask them to raise the PHP memory_limit to 256M.
5. Can I set the memory limit too high? Yes. You should not set it to an absurd number like 4096M. If a script really needs that much memory, it is almost certainly a bug or a “memory leak.” Setting a reasonable limit (like 256M or 512M) is a good safety measure.
6. How do I check my current PHP memory limit? The easiest, safest way is in your WordPress dashboard. Go to Tools > Site Health > Info > Server and look for “PHP memory limit.” If you have Elementor, go to Elementor > System Info for an even clearer view.
7. What’s the difference between wp-config.php and php.ini? wp-config.php is a WordPress file. It controls WordPress settings. php.ini is a server file. It controls the master settings for the PHP language itself. The php.ini file’s settings are more powerful and will always override wp-config.php.
8. Why does Elementor (or WooCommerce) seem to “need” more memory? They do not “need” more memory in a bad way. They use more memory because they are powerful, complex applications. A simple text blog is like a bicycle. A WooCommerce site built with Elementor is like a high-performance car. The car is not “worse” because it needs more fuel. It just does a lot more.
9. What is a “memory-hungry” plugin? This can be a plugin that is (a) very complex and powerful, like WooCommerce or a Learning Management System (LMS), or (b) poorly coded and “leaks” memory. You can find out which one you have by using the plugin conflict test.
10. Is it safe to edit wp-config.php? It is safe if you take precautions. Always download a backup of the file to your computer before you edit it. If you make a mistake and your site breaks, you can simply re-upload your original, untouched backup file to fix it immediately.
Looking for fresh content?
By entering your email, you agree to receive Elementor emails, including marketing emails,
and agree to our Terms & Conditions and Privacy Policy.