Want to learn how to develop a Drupal 8/9 module? Follow one (or all) of the guides below In this post, you will find a collection of online guides on Drupal 8/9 module development. Pick one that suits you and follow the instructions. It’s true that becoming a competent Drupal 8/9 module developer takes more […]
Learn how to increase WordPress memory limit in 2 different ways to keep your site running smoothly.
WordPress is an easy-to-use and flexible content management platform. Similar to any software, though, it can cause problems and difficulties for its admins now and again by generating errors. For non-tech-savvy users, this can be a big deal. More often than not, they can’t identify the cause of the issue themselves, let alone fix it. In this post, we talk about one such problem — the memory exhausted error. You will learn why it occurs and how to increase WordPress memory limit to get your site back on track.
As a WordPress agency with 16 years of industry experience and one of the top 15 WP development companies on Clutch, we’ve helped thousands of businesses make their websites fast, stable, and secure. We know how to fix every error the system might generate.
Since you’ve landed on this page, you must have run up against the memory exhausted error on your WordPress site and are looking for ways to resolve it. You are not alone. This issue is one of the WP problems its users complain about most.
The line that reads “Fatal error. Allowed memory size of […] bytes exhausted…” may sound scary to someone who sees it for the first time. In reality, though, this is not as awful as it seems. You can fix the issue in several ways yourself in just a couple of minutes if you know how.
Below, you will find 2 simple methods to increase memory limit in WordPress and have your site back to normal. Before we discuss them, however, you should understand why you see the memory exhausted error at all.
The WordPress Memory Exhausted Error: What Causes It
As you can guess, the problem arises when there’s not enough memory left. You may ask, “What memory? Memory for what?” The thing is that your WordPress installation is just a computer program. It needs a specific portion of disk space to do what it’s supposed to do: store the database, images, files, code for plugins and themes, and other resources.
WordPress uses the PHP programming language to power it. When you purchase a shared hosting plan, the provider gives your site a strictly limited amount of server memory.
In all likelihood, your website will eventually grow. Even if it’s just a simple blog, you might want to add photos or videos to make your posts more engaging. This will push you closer to that limit. If you have a larger site with lots of plugins and a sizable database, you will reach this point much faster.
Until the day you see the dreadful “Fatal…” message. This means that one of the PHP scripts responsible for your website operation has stopped running due to the lack of memory. Oh! The horror! Your site is down. If it’s a business resource, you may lose valuable traffic and put your reputation at risk. An urgent response is crucial.
What can you do? Seek professional assistance? Yes, this is one of the options. However, it may take precious minutes or hours to find a suitable pro to troubleshoot the issue. Why not try to solve the problem yourself? It’s actually quite straightforward. All you need to do is increase WordPress memory limit by applying one of the techniques we describe below: installing plugins and editing the wp-config.php file manually.
Before you perform any actions to increase memory limit in WordPress, make sure to back up your files and database, especially if you’re going to change the core code. You can use plugins for this purpose.
How to Increase WordPress Memory Limit: Method #1 — Installing Plugins
One of the easiest ways to augment the WordPress memory limit is to install and use a specialized extension you can find on the official site. Here is one you may consider trying.
WordPress WP Memory Limit, Memory Usage and Health Plugin
This tool allows you to check the current WordPress memory limit. More importantly, you can use it to increase WordPress memory limit without having to tweak any core code. Just install the plugin, activate it, and follow these steps:
- Click the Settings link under the plugin name.
- On the page that opens, you will see your current WordPress memory limit. For example, the current WP memory limit on this site is 40MB.
- Click the Update WordPress Memory Limit tab at the top of the dashboard.
- At the bottom of the page, you will see the “Update the WordPress memory limit to” dropdown. Increase WordPress memory limit by selecting a new, larger value. How far you will go depends on your needs. If your site is heavy in visuals or has lots of plugins, you can choose 64MB or even 96MB. Remember, though, that your hosting plan may restrict the amount of memory your site can consume. Get in touch with your hosting provider to find it out exactly.
- Click the Fix it Now! button. That’s all. You’ve set a new WordPress memory limit for your website.
How to Increase WordPress Memory Limit: Method #2 — Editing the wp-config.php File
Now, let’s dive deeper into the system’s internals. Another effective method to increase WordPress memory limit is to change the contents of the wp-config.php file manually. There’s probably no document within your WP installation as crucial as this one. It includes different variables that define the operation of your WordPress site.
One of these is “WP_MEMORY_LIMIT.” It’s this setting that allows you to increase WordPress memory limit and solve the memory exhausted problem. Here’s how you can do that:
- Find the wp-config.php file. It’s located in the root directory of your site along with the folders wp-admin, wp-content, and wp-includes. We assume you know how to access the folder system of your WordPress site by using the FTP protocol and a corresponding FTP client.
- Right-click on the wp-config. php file and choose the Edit menu item. This way, you will have this file, or rather its copy, on your local machine.
- Open it in any text editing tool and scroll down to the line /* That’s all, stop editing! Happy publishing. */.
- Add the following code right before that line: define(‘WP_MEMORY_LIMIT’, ’64M’); You can make this number 96M or even 128M. Again, it all depends on your needs and your hosting provider’s rules.
- Click the Save button in the editor and close it. The FTP client will offer you to switch the old edition of the wp-config. php file for the new one. Give your consent.
That’s it. If the error persists, you can repeat this process and set the memory limit value higher. Still see the “Fatal..” message? Then the problem can be in your hosting plan or provider. You might either have to purchase more server space, switch over to a virtual private server, or even choose a different hosting provider.
First, though, try the methods to increase WordPress memory limit we’ve discussed in this post.
WordPress is a fantastic CMS that powers millions of websites. Yet, sometimes it can generate errors that rank-and-file users are unable to fix on their own. If you come across the memory exhausted error while running your WP site, you can use at least two methods to solve the problem: install a plugin or modify the code of the wp-config.php file.
Whatever WordPress task you might have, the PSD2HTML WP development team, with 16 years of experience building perfect websites, is always ready to assist you. Developing projects from scratch, customizing themes, creating custom plugins to let you achieve your business objectives, maintenance, and speed optimization — we can do all this and much more.
Just drop us a line and get what you want exactly within the shortest time frame.
You might also find these posts useful:
WordPress Multisite vs Single Site: Unveiling the Truth about the Controversial WP Feature
Top 3 WordPress Backup Plugins to Ensure Your Website Data Safety
How to Remove “Powered by…” in WordPress, Shopify, and Squarespace
How to Speed Up Your WordPress Website: 5 Tips from PSD2HTML Developers
Can You Solve All Your Content Editing Problems with Gutenberg?
7 Reasons Why a Custom WordPress Theme Is Better for Your Business
What CMS to Choose for Your Website: PSD2HTML Recommends
Turn Your WordPress Site into a Powerful E-Commerce Store With WooCommerce
React WordPress Theme Development: Benefits and Drawbacks
WordPress Website Development: Common Problems and How to Deal with Them
The Best WordPress Developer Tools to Use in 2021
WordPress.org vs WordPress.com: 4 Distinctions Worth Noting
The Best WordPress Page Builder Contest: WPBakery vs Elementor
P2H Inc Is Recognized by Clutch as a Top-Performing WordPress Development Company
How to Duplicate a Page in WordPress: 1 Advanced and 2 Simple Methods