WordPress is the most popular content management system, powering over 40% of websites on the internet. However, even with its extensive features and plugins, it is not free from errors. One such error is the WordPress memory exhausted error, which can be frustrating for website owners. This error occurs when WordPress exceeds the allocated PHP memory limit.
The “WordPress Memory Exhausted” error occurs when your WordPress site exceeds the allocated PHP memory limit. Increasing the PHP memory limit can often resolve this issue. Here’s a step-by-step guide on how to do it:
If you have encountered this error, you don’t need to worry. In this article, we will discuss the best way of fixing the WordPress memory exhausted error by increasing the PHP memory limit. We will also look at some frequently asked questions to help you understand this error better.
Best Way Of Fixing WordPress memory exhausted error by increasing PHP memory limit:
Before we dive into the solution, let’s understand what the PHP memory limit is. PHP memory limit is the amount of memory allocated to a PHP script. WordPress is built on PHP, and it uses this memory to execute various functions and scripts. If WordPress exceeds the PHP memory limit, it will result in a fatal error, causing the website to crash.
There are several ways to increase the PHP memory limit in WordPress, but we will discuss the best way of doing it below.
Edit the wp-config.php file : WordPress Memory Exhausted Error
The wp-config.php file is a crucial file in WordPress that contains configuration settings for your website. To increase the PHP memory limit, follow the steps below:
- Log in to your WordPress website via FTP or cPanel File Manager.
- Locate the wp-config.php file in the root directory.
- Right-click on the file and select Edit.
- Add the following code above the line that says “That’s all, stop editing! Happy blogging.”
define('WP_MEMORY_LIMIT', '256M');
You can change the value to any limit you want, but 256M is a good starting point for most websites.
- Save the changes and close the file.
Edit the .htaccess file | WordPress Memory Exhausted Error
The .htaccess file is another important file in WordPress that contains configuration settings. To edit this file, follow the steps below:
- Log in to your WordPress website via FTP or cPanel File Manager.
- Locate the .htaccess file in the root directory.
- Right-click on the file and select Edit.
- Add the following code at the end of the file:
php_value memory_limit 256M
5. Save the changes and close the file.
Restart your web server:
After editing php.ini
, you may need to restart your web server for the changes to take effect.
Contact Your Hosting Provider
If you are not comfortable editing files or if these methods don’t work, contact your hosting provider. Many shared hosting providers have restrictions on modifying certain settings, and they may be able to increase the PHP memory limit for you.
After implementing one of these methods, the “WordPress Memory Exhausted” error should be resolved, and your site should function properly.
FAQs:
What is the recommended PHP memory limit for WordPress?
The recommended PHP memory limit for WordPress is 256M. However, depending on your website’s size and traffic, you may need to increase it further.
How do I know if my website has exceeded the PHP memory limit?
You will see the WordPress memory exhausted error message on your website if it has exceeded the PHP memory limit.
Can I increase the PHP memory limit on shared hosting?
Yes, you can increase the PHP memory limit on shared hosting. However, some hosting providers may not allow you to do so. In that case, you will need to contact your hosting provider to increase it for you.
Conclusion:
The WordPress memory exhausted error can be frustrating, but it is fixable by increasing the PHP memory limit. We hope that this comprehensive guide has helped you understand the error better and provided you with the best way of fixing it.
By following the steps outlined above, you should be able to increase the PHP memory limit and avoid the error in the future. If you have any further questions or concerns, don’t hesitate to contact your hosting provider or seek help from a WordPress developer. Remember, keeping your website running smoothly and error-free is crucial for a successful online presence. There are other Common WordPress Errors That could lead in trouble for new webmasters. You can Check out our detailed post on Common WordPress Errors.