Sometimes, you will happen to encounter a ‘Fatal Error: Memory Size Exhausted’. This could be a confusing error at first for non-technical users, as the user won’t know the cause of this error or even how to get it fixed. Memory size error is one of the most common errors and one of the simplest to resolve, achievable even by new WordPress users with some guidance.
Memory limit errors are not only in WordPress, but they can happen on any other website builder. This guide will explain to you all the best practices and steps to fix this error on WordPress. If you are running some other web builder, don’t worry. The tips below also apply and should work for you. Before we get into the details, we first need to understand what the error is.
a WordPress Memory Error?
WordPress is a pretty smooth running and reliable platform, but it isn’t free from errors like any software, app, or program.
WordPress memory error, also known as ‘PHP memory exhausted’ error, means that your server is not allocating enough resources for WordPress to execute all the PHP scripts it needs to run your website correctly. Fortunately, this error is not too difficult to fix or troubleshoot, but it can be intimidating to newcomers as they don’t know how to approach this problem.
This error can occur in several different situations, but it is most likely after when you take specific type of actions such as:
- Installing a new theme
- Installing too many plugins
- Uploading too much media to your website
- In rare cases, when upgrading to a more recent version of WordPress.
Main Reason of WordPress Memory Limit Error on Your Site
Fix and Increase WordPress Memory, but how…?
The WordPress memory limit error means that there is not enough resource for your WordPress installations to function correctly. The clue to the cause of this error is always present in the name itself.
Don’t get scared by the error; it just tells you that your website requires a certain quantity of memory to work correctly or to run the newly installed theme or plugin.
Your web hosting server provides this memory. Web hosting servers allocate a specific amount of resources or memory for your website to store all the elements of your website and enable it to function smoothly for your visitors.
Fix and Increase WordPress Memory
5 Easy Ways to Resolve, Fix or Troubleshoot WordPress Memory Limit Error
The WordPress memory limit error is straightforward to troubleshoot as compared to many other common mistakes. It has a clear cause, which is that you are not allocating enough memory to your site. To help you solve this problem, follow our guidance below.
- Directly Increase the Limit via ‘PHP.ini” File
You can directly increase the WordPress memory limit if you have access to the PHP.ini file. If you use shared web hosting because, in most cases, you will not have access to the PHP.ini file. On the bright side, some servers allow you to create a duplicate PHP.ini file in your site directories whose data or values can replace the default ones.
How to Implement: To carry out this method, first, you need to have access to the ‘PHP.ini’ file. You need to create a file named ‘php.ini’ in the directory where your WordPress site is installed. In there, add the command “memory_limit = 64M” to increase the memory limit to 64MB.
The increased limit will depend on your hosting provider’s maximum limit in giving your website according to your web hosting plan. If you want more, then it is worth contacting your web hosting provider to find out what your next steps should be.
- Changing the Memory Limit Via Wp-config.PHP
Increasing your WordPress memory limit through wp-config.php is remarkably easy to do. Simply follow the steps below, and you should be set in no time.
How to Implement: For this, you will need to login into your site directly, using a Secure File Transfer Protocol (SFTP). You need to install an SFTP client such as Filezilla, which is free and relatively easy to follow.
Once you have access to your website through the SFTP client, open the WordPress root folder and find the wp-config.php file. Right-click on it to edit it, which should then open it in your default text editor.
Quite near the end, keep an eye for the line “define(‘WP_MEMORY_LIMIT’, ’64M’); this is where you need to change the memory limit of your website.
- Using .HTACCESS File to Increase the WordPress Memory Limit
Sometimes, hosting service providers allow their users to increase their WordPress memory limit using .htaccess file. .htaccess is a Unix-based file in servers that can only be added via FTP at the website’s root folder.
How to Implement: For this, you need to follow the same steps as above, but this time, you need to open the .htaccess file.
To increase the WordPress memory limit using the .htaccess file, you need to add the below code to the end of the file while replacing the digits with the memory limit you want.
“php_value memory_limit 128M”
- Increasing WordPress Memory Limit Via install.PHP
This method is primarily an alternate method to our first option of the php.ini method. The function of the code we use in this method is the same as what we put in our first method.
How to Implement: Put the code “ini_set(‘memory_limit’,’128M’);” in the install.php file, which is in the wp-admin folder in your WordPress directory files.
- Call Your Hosting Service Provider
Suppose you have already tried all the methods above without any success. In that case, the best thing is to contact your web hosting provider to check if they prevent you from increasing the memory limit manually from your end. With our experience, some web host providers will help you improve your memory limit if you ask them.
However, if your web hosting provider tells you that it will not be possible to increase the PHP memory limit, you might have to think about:
- Changing your web hosting provider
- Upgrade to a higher tier plan of hosting
- Trying Virtual Private Server (VPS) or Cloud Hosting
- We always recommend you to make a backup of your entire site should anything happen during this process. You don’t want to lose anything or make things more complicated than they need to be.
- Try any one method of the above five methods. Don’t try to implement all five methods at the same time. You want to see what is working and what isn’t.
- If you are doing this for the first time, we recommend consulting with your host service provider first.
How to Fix and Increase WordPress Memory in 5 Ways -Final Thoughts
It is frustrating to encounter an error on your WordPress website when it doesn’t offer much detail regarding what the error is about and how to resolve it. Luckily, the WordPress memory limit error is one of the most common and easy to solve problems with minimal guidance.
You can fix your website’s WordPress memory errors automatically or by contacting your hosting service provider. Either way, here is a quick summary of the guide and how you can increase your WordPress memory limit.
- Directly increase the limit via the ‘PHP.ini” file.
- Changing the memory limit via wp-config.php file.
- Using .HTACCESS file to increase the WordPress Memory Limit.
- Increasing WordPress memory limit via install.php file.
- Call your hosting service provider, who can further assist you with the problem.
If you have any queries or further questions regarding the WordPress memory limit error or any other specific error, get in touch, and we’d be happy to help.