How to Fix Memory Exhausted Error in WordPress by Increasing PHP Memory

  • September 26, 2025
  • vinaka
  • 14 min read

What Does the Memory Exhausted Error in WordPress Mean?

When you see the Memory Exhausted Error in WordPress, it means that your website has used up the maximum amount of memory that PHP is allowed to use. In simple terms, your website asked the server for more memory than it was given, and as a result, it could not complete the task.

Every WordPress site runs on PHP, and your hosting provider allocates a certain amount of memory for it. If your site has many plugins, a heavy theme, or resource-intensive scripts, the allocated memory might not be enough. That is when this error appears.

The error usually looks like this on your screen:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 123456 bytes) in /home/yourwebsite/public_html/wp-includes/plugin.php on line XXX

This message may look confusing at first, but it simply tells you that the memory limit (in this example, 64MB) was not sufficient, and WordPress failed to complete the requested operation.

Understanding this error is the first step to fixing it, and the good news is that it is a very common issue with straightforward solutions.

Common Causes of WordPress Memory Exhaustion

The memory exhausted error does not happen randomly. It is usually triggered by specific factors that put extra pressure on your website’s allocated memory. Knowing the root causes will help you not only fix the error but also prevent it from happening again. Here are the most common reasons:

1. Heavy Themes or Plugins

Some premium or multipurpose themes come loaded with features, visual builders, and scripts that consume a large amount of memory. Similarly, resource-heavy plugins such as page builders, security scanners, or backup tools may demand more resources than the allocated memory can handle.

2. Too Many Active Plugins

Having a long list of active plugins, especially when many of them serve similar functions, can quickly drain available memory. Even if each plugin uses only a small amount of resources, the combined load can become overwhelming for your hosting environment.

3. Poorly Coded Scripts

Not all themes and plugins are coded efficiently. Poorly optimized scripts can cause memory leaks, repeated processes, or unnecessary database calls. This results in excessive memory usage and leads to the error showing up more frequently.

4. Low Hosting Memory Allocation

Many shared hosting plans come with a limited PHP memory allocation. If your website is growing in traffic or functionality, the default limit set by your hosting provider may no longer be enough. In such cases, you will likely face this error until the memory limit is increased.

By identifying which of these factors applies to your site, you can apply the right solution and ensure WordPress runs smoothly without frequent interruptions.

Quick Checks Before Fixing the Error

Before diving into technical fixes, it is wise to perform a few quick checks. Sometimes the issue is caused by something small and temporary, and these simple steps can save you from unnecessary troubleshooting.

1. Clear Cache

If your site is using a caching plugin or server-level caching, the error message may be stored in the cache even after the issue has been resolved. Clear your WordPress cache, browser cache, and if applicable, CDN cache. This ensures you are seeing the most recent version of your site.

2. Deactivate Recently Installed Plugins

If the error started appearing after installing or updating a plugin, that plugin could be the culprit. Deactivate the most recent additions first, then check if the problem disappears. If it does, you have identified the cause. You can either look for an alternative plugin or contact the developer for support.

3. Switch Temporarily to a Default Theme

Themes can also be responsible for memory overload. To rule this out, temporarily switch to a default WordPress theme like Twenty Twenty-Four. If the error goes away after changing the theme, your original theme may be consuming too many resources or might have a coding issue that needs to be addressed.

These quick checks often solve the issue without requiring deeper changes. If the error persists, you can then move on to increasing your PHP memory limit.

Step-by-Step Methods to Increase PHP Memory Limit

If the quick checks did not solve the problem, the next step is to increase the PHP memory limit. WordPress provides multiple ways to do this, and most of them are simple enough even for beginners. Below are the most reliable methods you can try.

1. Edit the wp-config.php File

This is the most common and straightforward method.

  1. Access your WordPress files using an FTP client or your hosting file manager.
  2. Locate the file named wp-config.php in the root directory of your WordPress installation.
  3. Open the file and look for the line that says:

/* That’s all, stop editing! Happy publishing. */ 

4. Just above that line, add the following code:

define(‘WP_MEMORY_LIMIT’, ‘256M’); 

5. Save the file and refresh your website.

If the error was caused by low memory, this should fix it.

2. Edit the php.ini File

Some hosting providers allow you to edit the php.ini file directly, which controls server-side PHP settings.

  1. Go to your hosting account’s file manager or connect via FTP.
  2. Search for the file named php.ini (if it does not exist, you may need to create one).
  3. Add or update the following line in the file:

memory_limit = 256M 

4. Save the changes and check your site again.

3. Edit the .htaccess File

If you cannot access or modify php.ini, you can try adjusting memory through the .htaccess file.

  1. Find the .htaccess file in your site’s root folder.
  2. Edit the file and add the following line at the bottom:

php_value memory_limit 256M 

3. Save the file and reload your website.

4. Increase Memory Limit via cPanel or Plesk

Most hosting providers offer cPanel or Plesk, where you can manage PHP settings easily.

  1. Log in to your hosting control panel.
  2. Look for Select PHP Version, MultiPHP Manager, or PHP Settings.
  3. Find the option to adjust memory_limit.
  4. Set it to 256M or higher, depending on your needs.
  5. Save changes and test your site.

This method is useful for users who prefer a visual interface rather than editing files manually.

5. Use a WordPress Plugin

If editing files feels intimidating, there are plugins designed to simplify this task. Some system management or performance optimization plugins let you increase the PHP memory limit directly from the WordPress dashboard. While this method may not always work if your hosting restricts memory allocation, it can be a quick solution for beginners.

When to Contact Your Hosting Provider

Sometimes, no matter how many adjustments you make, the memory exhausted error will not go away. This usually happens when your hosting provider has placed strict limits on how much PHP memory your account can use. In such cases, editing files or installing plugins will not bypass those restrictions.

If You Are on Shared Hosting with Restricted Limits

Shared hosting plans often come with limited resources since multiple websites share the same server. Even if you manually increase the memory in WordPress, the hosting provider may cap it at a fixed level. If your site has grown in size or traffic, shared hosting may not be enough to support its requirements.

How to Request a Higher PHP Memory Allocation

If you suspect hosting restrictions are the cause, reach out to your hosting provider’s support team. When contacting them, you can:

  • Clearly explain that you are facing a PHP memory exhausted error.
  • Ask if they can increase the PHP memory_limit for your account, ideally to at least 256M.
  • Provide them with the exact error message if possible, as this helps them understand the issue quickly.

Most reputable hosting providers will either adjust the memory limit for you or guide you on the steps required. If your hosting plan does not allow an increase, you may need to consider upgrading to a higher-tier plan, such as VPS or managed WordPress hosting.

Best Practices to Prevent Memory Exhaustion in Future

Fixing the memory exhausted error is only part of the solution. To keep your WordPress site running smoothly, it is important to take preventive steps. Following best practices will help reduce the chances of this issue appearing again as your site grows.

Regularly Update WordPress, Themes, and Plugins

Outdated versions of WordPress, themes, or plugins can contain bugs and inefficiencies that use more memory than necessary. Developers release updates not just for new features but also to improve performance and fix resource issues. Keeping everything up to date ensures your site is using optimised code.

Remove Unused Plugins and Themes

Every active plugin or theme consumes memory. Even inactive ones can leave behind extra files and settings that slow down your site. Review your plugins and themes regularly, deactivate the ones you no longer need, and remove them completely. This practice lightens the load on your server and helps avoid memory exhaustion.

Optimise Database and Images

A bloated database and uncompressed images are common causes of excessive memory usage. Use tools or plugins to clean up old revisions, spam comments, and temporary files from the database. For images, compress them before uploading or use an optimization plugin to reduce their size without losing quality. These small steps significantly lower the overall demand on your server.

Consider Upgrading Hosting

If your website traffic is increasing or your site relies on resource-heavy plugins and features, shared hosting may no longer be sufficient. Upgrading to a VPS or managed WordPress hosting plan gives you more dedicated resources, including higher PHP memory limits. This ensures your site remains stable as it grows.

Troubleshooting If Increasing Memory Doesn’t Work

In some cases, increasing the PHP memory limit may not resolve the memory exhausted error. This usually means that something else on your website is consuming resources in an unusual way. To identify the root cause, you can follow a few troubleshooting steps.

Identify the Specific Plugin or Theme Causing Issues

Plugins and themes are often the main culprits when it comes to high memory usage. To pinpoint the issue:

  1. Deactivate all plugins on your site.
  2. Check if the error disappears.
  3. If the site loads normally, reactivate the plugins one by one until the error returns. The last plugin you activated is most likely causing the issue.
  4. If the error persists even after deactivating all plugins, switch to a default WordPress theme like Twenty Twenty-Four. If the issue is resolved, your theme may be responsible.

Once you identify the problematic plugin or theme, consider replacing it with a better alternative or contacting the developer for a fix.

Enable WordPress Debug Mode to Track Errors

WordPress has a built-in debug mode that helps uncover hidden issues. To enable it:

  1. Open your wp-config.php file.
  2. Add or update the following lines:

define(‘WP_DEBUG’, true); 

define(‘WP_DEBUG_LOG’, true); 

define(‘WP_DEBUG_DISPLAY’, false); 

3. Save the file.

This will create a debug.log file inside the wp-content folder, where you can see detailed error reports. These logs can help you identify whether a plugin, theme, or script is consuming too much memory.

Check Server Logs for Deeper Issues

If debugging in WordPress does not reveal the cause, your hosting server logs can provide more insight. These logs often highlight errors related to PHP processes, server configurations, or resource overload. You can usually access them from your hosting control panel or request them directly from your hosting provider.

Analysing these logs will help you understand if the issue is purely related to WordPress or if it stems from server-level restrictions.

Conclusion

The memory exhausted error in WordPress may look alarming at first, but it is a common issue with straightforward solutions. In most cases, simply increasing the PHP memory limit through the wp-config.php, php.ini, or .htaccess file resolves the problem. Hosting control panels like cPanel or Plesk also make the process easier, and beginner-friendly plugins can help if you prefer not to edit files.

If adjusting the memory limit does not work, deeper troubleshooting is required. Identifying faulty plugins or themes, enabling WordPress debug mode, and reviewing server logs can reveal the real cause behind the error.

To prevent this issue from reappearing, make it a habit to keep WordPress, themes, and plugins updated, remove anything unnecessary, optimize your database and images, and consider upgrading to a hosting plan that provides sufficient resources as your site grows.

And finally, if you are still stuck after trying all these methods, do not hesitate to contact your hosting provider. They can confirm whether your account has strict memory limits and guide you toward the best solution.

By applying these fixes and following preventive practices, you will not only resolve the error but also keep your WordPress site stable, fast, and ready to grow without unnecessary interruption.

We Are Here to Help

Fixing technical errors, such as the memory exhausted issue, is not always straightforward, and it can take valuable time away from running your business. That is where we can help. As the best website development company, we provide end-to-end WordPress development services designed to keep your site secure, fast, and reliable. From troubleshooting errors and optimizing performance to building fully customized websites, our team has the expertise to handle it all.

We offer professional solutions tailored to your business goals, including:

In addition to WordPress expertise, we also provide comprehensive Odoo development services through our sister company. Whether you need a robust CRM, full ERP implementation, or advanced customizations, we can support your growth with:

We proudly serve clients across the UK, USA, Europe, Australia, Canada, New Zealand, the Middle East, and Africa. From small businesses to large enterprises, we help organisations strengthen their digital presence with solutions that deliver measurable results. If you are struggling with your WordPress site or want professionals to manage and grow your online presence, reach out to us today. Let us take care of the technical challenges so you can focus on what matters most — scaling your business with confidence.

Frequently Asked Questions

What does the memory exhausted error mean in WordPress?

This error appears when WordPress reaches the maximum PHP memory limit set by your hosting environment. In simple terms, your website tries to use more memory than it has been allocated, causing the site to stop loading properly.

What is the recommended PHP memory limit for WordPress?

WordPress recommends a memory limit of at least 256MB for smooth performance. However, for larger websites with heavy plugins or high traffic, you may need to increase it to 512MB or higher, depending on your hosting plan.

Is it safe to increase the PHP memory limit?

Yes, increasing the memory limit is safe as long as it is done within the limits allowed by your hosting provider. It does not harm your website or server. In fact, it helps WordPress run more efficiently when your site needs more resources.

How do I know which plugin or theme is causing memory issues?

The best way to identify the culprit is by deactivating all plugins and reactivating them one by one until the error appears again. If the error persists even with plugins disabled, switch to a default WordPress theme to see if the problem lies with your theme.

What should I do if increasing memory does not fix the error?

If the error continues after raising the memory limit, enable WordPress debug mode and check the debug log for detailed error messages. You can also review your hosting server logs or contact your hosting provider to check if strict memory limits are in place.

Can hosting affect memory allocation in WordPress?

Yes, hosting plays a major role. Shared hosting plans usually have strict limits, while VPS and managed WordPress hosting offer more memory and dedicated resources. If your site is growing, upgrading your hosting plan can prevent frequent memory issues.

Leave a Reply

Your email address will not be published. Required fields are marked *