WordPress is a flexible platform that supports a wide range of themes, plugins, file formats, and additional software. However, when attempting to upload these resources, you may occasionally encounter the WordPress memory limit error.
Fortunately, there are ways to resolve this error. By increasing the PHP memory available on your WordPress website, you can continue to add content and grow your site without any issues.
In this post, we’ll share four ways to increase the WordPress memory limit to solve any errors that you’re experiencing on your site:
- Edit wp-config.php and increase wp_memory_limit
- Change your server settings via PHP.ini
- Edit your .htaccess file
- Upgrade your website’s hosting plan
If you’re interested to learn why this problem occurs, you’ll find an explanation at the end of this post. Let’s get started!
How to increase WordPress memory limit
Below, we’ll feature four different methods you can try to increase the WordPress memory limit.
Unfortunately, we can’t guarantee that all of these solutions will work for you because it depends in large part on how your hosting environment is configured. That’s why we shared four different methods – at least one of these should work for your situation.
Because some of these fixes involve editing core WordPress files, we highly recommend that you take a backup of your site before proceeding.
There are many backup solutions available, but the UpdraftPlus plugin gives you the freedom to upload your content to different cloud storage platforms.
Once you have a recent backup of your site, here are some ways to increase the WP memory limit.
1. Edit wp-config.php and increase wp_memory_limit
If you’re running low on memory, there’s a simple solution: increase the amount of memory you have access to! WordPress lets you set the current memory limit in its wp-config.php file via the
wp_memory_limit variable. However, this limit may be less than the amount of memory provided with your hosting plan.
If this is the case, you may be able to resolve this error by editing your wp-config.php file. Making changes at the code level does carry a degree of risk, so it’s smart to create a backup of your site before proceeding.
To edit the wp-config.php file, you’ll need to connect to your server via File Transfer Protocol (FTP) using an FTP client such as FileZilla.
You can read our full WordPress FTP guide if you’re not sure how to use FTP, but here’s a quick tutorial on how to connect with FileZilla.
Inside the FileZilla application, navigate to File > Site Manager. If this is your first time connecting over FTP, then select File > Site Manager > New Site:
You can now enter some information about your site, along with your FTP username and password. If you don’t know your FTP credentials, you can typically find this information in your web hosting account.
FileZilla will now connect to your site and display all of its files. In the app, navigate to your site’s root folder:
Inside this folder, right-click on the wp-config.php file, and select View/Edit. This opens wp-config.php in your default text editor. Now, search for the following phrase –
It might look something like this:
define( 'WP_MEMORY_LIMIT', '32M' );
If this code already exists in your wp-config.php file, you need to increase the number. For example, you can increase it from
If you don’t see this line of code in the file, you’ll need to add it. Just add the following code above the line that says
/* That's all, stop editing! Happy publishing. */:
define( 'WP_MEMORY_LIMIT', '256M' );
2. Change your server settings via PHP.ini
You may also be able to lift the memory limit by editing your PHP.ini file. This file sets the default configuration for any application that requires PHP.
Every time someone visits your WordPress site, PHP runs on your server. During this process, the PHP programming language looks to the PHP.ini file for instructions. This includes setting your current WordPress memory limit.
If your host uses cPanel, you may be able to edit the PHP.ini configuration via cPanel. Typically, this tool is called something like MultiPHP Manager, MultiPHP INI Editor, or PHP Config. Not all hosts give you this ability, though.
For example, if you host at Bluehost, you’ll get a tool called MultiPHP INI Editor in the full cPanel dashboard (which you can access from the Advanced tab).
Once you open this tool, you can adjust the memory limit:
If your host doesn’t offer an in-dashboard PHP.ini editor, you also might be able to edit the PHP.ini file via FTP.
Once you’re connected, navigate to the root directory in the FileZilla window and locate the file.
Open the file and look for a line that includes
memory limit=. You can now increase this value and save your changes.
Before these changes can come into effect, you’ll need to restart your server. Once your server is back up and running, you should no longer encounter the WordPress memory limit error.
3. Edit your .htaccess file
The .htaccess file is an important configuration file if your web host uses Apache (which many hosts do). This file controls a lot of your site’s configuration, including its memory limit.
You can use .htaccess to relay instructions to your server, without having to edit your server configuration files. This makes .htaccess a good alternative if you can’t access your PHP.ini file.
To access this file, connect to your server using an FTP client, as we discussed in the previous sections. You can then navigate to your site’s public_html directory, which contains the .htaccess file:
Now, open this file and add the following code snippet below the
# END WordPress line:
php_value memory_limit 256M
Here’s what it might look like:
Make sure to save your changes when you’re done.
4. Upgrade your website’s hosting plan
While you can often increase the memory that’s available to your site, you’re ultimately restricted by your hosting plan. Each plan will grant you access to a finite amount of resources. If you’ve tried all of the above fixes and you’re still encountering this error, then you may have outgrown your current plan.
If you want to check your memory allocation, you should be able to find this information on your web host’s website, or in your hosting panel. Alternatively, you can always contact your provider for assistance.
If you suspect that you’ve reached the limit of your allocated resources, you may want to consider upgrading your plan. This may involve moving to a higher tier, or switching to a different type of plan. For example, if you’re currently on a shared hosting plan, then it may be time to upgrade to a virtual private server (VPS). You might even splash out on a dedicated server.
Alternatively, you may decide to change your hosting provider. When searching for a new host, we recommend paying careful attention to the amount of memory allocated as part of each plan. Wherever possible, try to find a provider that offers a default memory limit of 256 MB or higher.
It’s also smart to opt for a flexible provider. If you can easily increase the amount of resources allocated to your site, you’re far less likely to encounter the memory limit error in the future.
Why you may encounter the “WordPress Memory Limit” error
Whenever you encounter an error in WordPress, you’ll naturally want to solve the problem as quickly as possible. However, it often helps to understand what the error is, and why it occurs. You can then take steps to avoid encountering this problem in the future.
Most common WordPress errors are fairly easy to resolve, but this platform doesn’t always provide much explanation in its error message. For example, the 500 internal server error is notoriously vague.
With WordPress, everything you upload or install is stored on a server. When you purchase a web hosting plan, your provider allocates a certain amount of resources to your site. This includes the memory that’s used to store all of your website’s content.
Sometimes, when attempting to upload media to your WordPress site, you may encounter the following message: “Fatal error: allowed memory size of 67108864 bytes exhausted”. This problem can also occur when you attempt to install a new theme or plugin. Regardless of the trigger, this error means that you’ve run out of memory.
As we’ve covered in this post, you can minimize your chances of encountering this problem by increasing your memory limit and potentially investing in a more advanced hosting plan. As a general rule, the more expensive your hosting plan, the more space and memory you’ll have access to.
However, even higher-tier hosting plans rarely grant you access to unlimited resources. For this reason, it’s smart to take steps to minimize your memory usage. This may include uninstalling unnecessary plugins and making other performance optimizations.
Fix WordPress memory limit issues for good
Most of the time, you can upload files to your site and install additional software without any issues. However, at some point you may encounter the WordPress memory limit error.
Let’s quickly recap four ways to increase the WordPress memory limit and resolve this problem:
- Increase the PHP WordPress memory limit by editing your wp-config.php file.
- Change your server settings by editing PHP.ini.
- Edit your .htaccess file to increase PHP memory limit.
- Upgrade your website’s hosting plan to one with more resources.
For some general tips on WordPress issues like this one, check out our guide to WordPress troubleshooting. We also have a guide on how to fix the 20+ most common WordPress errors.
Do you have any questions about how to solve this common WordPress error? Let us know in the comments section below!
2 thoughts on “4 Easy Methods for 2021”
Verizon Fios residenial vpn services are here: https://www.proxies.tv/cart.php?gid=2
cialis without prescription 21 Average age of the patients was 66 years