What is WordPress Memory Limit Exhausted Error?
WordPress is written in PHP, a complex server-side programming language. Every website requires a WordPress host to ensure that PHP functions correctly.
Web servers function in the same manner as any other device does. Multiple apps can’t function efficiently without enough memory. Usually the Server admins of your hosting provider set a maximum amount of memory for individual WordPress processes on their servers.
The “WordPress Memory Limit Exhausted Error” is an error message that may be displayed when WordPress Code runs out of this maximum amount of memory for your WordPress service while trying to perform a task. This error can occur for a variety of reasons, such as when a plugin or theme uses too much memory, or when WordPress is trying to process a large amount of data. Logically, the question arises How to increase memory limit in WordPress.
When this error occurs, you may see a message similar to “Fatal error: Allowed memory size of xxxxxx bytes exhausted“. The message may also include the name of the file where the error occurred, such as “wp-admin/includes/file.php on line xxx”.
What is the WordPress PHP memory limit?
HTML pages are generated by the PHP server-side programming language.
As a dynamic programming language, PHP can handle WordPress queries, conduct computations, and more, but it has memory requirements.
While 32 MB is WordPress’s default memory limit, increasing it is a common necessity. WooCommerce, for one, suggests no more than 64 MB for WordPress’s allotted memory.
WordPress will attempt to increase the RAM limit from the default of 30 MB for a single site to a maximum of 64 MB for a network of sites as soon as it reaches that threshold. When that doesn’t work, a fatal error message will be displayed.
Most websites only need around 128 MB of memory, unless you’ve installed a plugin that uses a lot more. It is possible to monitor how much RAM is being used by each plugin by installing the Server IP & Memory Use Display plugin.
When the plugin is activated, you can temporarily disable plugins to observe their impact on system memory consumption.
How can I increase PHP memory limit in WordPress?
Increasing WordPress’ memory limit is easy, and can be done in one of three places: the php.ini file, the .htaccess file, or the wp-config.php file. This article will discuss each of these options in depth and show you how to increase WP Memory limit in WordPress.
Edit your WordPress website wp-config.php file
Another way to increase the memory limit in WordPress is by editing the wp-config.php file. This method is especially useful if you don’t have access to either the php.ini file or the .htaccess file.
To increase the memory limit in WordPress by editing the wp-config.php file, follow these steps:
Locate the wp-config.php file on your server. This file is usually located in the root directory of your WordPress installation. You can access it via cPanel or a FTP Client.
Open the wp-config.php file via a Text editor.
Add the following line to the file, just above the line that reads /* That’s all, stop editing! Happy blogging. */:
define(‘WP_MEMORY_LIMIT’, ‘xM’);
where x is the desired memory limit in megabytes. For example, to increase the memory limit to 256 megabytes, you would add the line
define(‘WP_MEMORY_LIMIT’, ‘256M’);.
Save the wp-config.php file and close the text editor.
Test your website to see if the memory limit has been increased. If you continue to see the “memory exhausted” error, you may need to increase the memory limit even further.
Edit your PHP.ini file
If changing the wp-config.php file doesn’t solve the problem, you’ll have to deal with the problem in your server settings via the PHP.ini file. You won’t be able to access your PHP.ini file if you’re using shared hosting.
The php.ini file is a configuration file that controls various aspects of PHP, including the memory limit.
To increase the memory limit in WordPress by editing the php.ini file you first need to access your file manager or FTP Client. Follow these steps:
Locate the php.ini file on your server. This file is usually located in the root directory of your WordPress installation, but it may also be located in a subdirectory, such as /etc/php/.
Open the php.ini file using a text editor.
Find the line that reads memory_limit = xM, where x is the current memory limit in megabytes.
Increase the value of x to the desired memory limit. For example, to increase the memory limit to 256 megabytes, you would change the line to read memory_limit = 256M.
It’s also a good idea to modify the max_execution_time line. This line specifies the amount of time in seconds allotted for a PHP script to run. If the time limit is exceeded, PHP returns an error. Increasing this number gives your scripts more time to run, which is a good idea if you’re planning to use more memory-intensive services and plugins.
Save the php.ini file and close the text editor.
Test your website to see if the memory limit has been increased. If you continue to see the “memory exhausted” error, you may need to increase the memory limit even further.
Edit your .htaccess file
If you don’t have access to the php.ini file, you can also increase the memory limit in WordPress by editing the .htaccess file.
To achieve this, follow these steps:
Locate the .htaccess file on your server. This file is usually located in the root directory of your WordPress installation.
Open the .htaccess file using a text editor.
Add the following line to the end of the file – after the “END WordPress” Comment:
php_value memory_limit xM, where x is the desired memory limit in megabytes. For example, to increase the memory limit to 256 megabytes, you would add the line
php_value memory_limit 256M.Save the .htaccess file and close the text editor.
Test your website to see if the memory limit has been increased. If you continue to see the “memory exhausted” error, you may need to increase the memory limit even further.
Use a memory increase plugin
Another option to increase your available PHP memory is through the use of a plugin, such as the WordPress WP Memory Limit, Memory Usage, Server Memory, and Health plugin. This plugin works with WordPress version 5.2 or higher and lets you modify available PHP memory without the need to access or modify files.
What is a good memory limit for WordPress?
The appropriate memory limit for WordPress depends on your site’s specific needs and resources. In general, a memory limit of at least 64 MB is recommended for most WordPress sites. However, sites with many plugins or sites that receive a lot of traffic may need more memory to function properly.
To determine the optimal memory limit for your WordPress site, you can try increasing the memory limit in small increments (e.g., 64 MB, 128 MB, 256 MB, etc.) and testing your site after each change to see how it performs. If you can increase the memory limit without encountering any errors or performance issues, then your site may be able to benefit from a higher memory limit.
It’s also a good idea to optimize your WordPress site to use as little memory as possible. This may involve optimizing your site’s code, disabling unnecessary plugins, and optimizing your database. These steps can help ensure that your site runs smoothly and efficiently, even with a lower memory limit.
How can I check my WordPress memory limit?
Once your Memory limit has been set, you can try to find out if it works. This procedure applies to users running WordPress 5.2 or above.
There are a few different ways you can check your WordPress memory limit:
- Check the value of the WP_MEMORY_LIMIT constant: You can check the value of the WP_MEMORY_LIMIT constant in your wp-config.php file. This constant sets the maximum amount of memory that can be used by WordPress. The default value is 128M.
- For advanced WordPress Developer:
Use the phpinfo() function: You can create a PHP file that calls the phpinfo() function and then upload it to your WordPress site. When you visit the file in your browser, it will display a lot of information about your PHP configuration, including the memory limit. - Use a plugin:
There are several WordPress plugins that can help you check your memory limit, such as the WordPress System Status plugin. These plugins can provide an easy way to check your memory limit and how much memory each plugin consumes without having to edit any files or use PHP functions.
WordPress plugins that help you check your memory limit
WordPress Simple System Status: This plugin provides a detailed overview of your WordPress site’s system information, including the memory limit, PHP version, and more.
WP Server Health Stats: This plugin displays a variety of server and site statistics in your WordPress dashboard, including the memory limit and other PHP configuration values.

WP Site Health Check
Site Health Check: The default Site Health Check is part of the WordPress core and provides a site health check tool that includes information about your memory limit and other system parameters.
Upgrade your website’s hosting plan
While you may be able to boost your site’s memory allocation, you are still bound by the limits of your hosting package. In each strategy, you’ll have access to a fixed pool of available assets. If you’ve already tried these solutions and are still getting this error, you may have outgrown your current plan.
You can typically obtain your memory usage statistics on your web host’s site or in your control panel. Another option is to get in touch with your service provider.
You should consider upgrading your plan if you believe you are nearing or at the limit of the resources it provides. This could mean upgrading to a more expensive tier or switching to a different plan entirely.
Upgrading from a shared hosting plan to a VPS, for instance, may be the best option if you have a lot of traffic (VPS). You could splurge on a dedicated server.
Conclusion
The RAM limit in WordPress can be easily increased by modifying the php.ini,.htaccess, or wp-config.php files. If you follow the advice in this post, you should be able to fix the “memory exhausted” error and make your website work properly again.
Remember that increasing the RAM limit isn’t always the best answer to the “memory exhausted” issue. It’s possible that a too resource-intensive plugin or theme is the blame for the problem. When this happens, you can try to fix the problem by disabling the plugin or removing the theme.
I’m hoping you’ve learned something from this post about how to increase memory limit in WordPress. Leave your thoughts, questions, and feedback in the space provided below.
Our other Blog posts

How to Edit wp-config.php in WordPress
Have you seen a tutorial that instructs you to update the wp-config file on your website, but you have no

What is a WordCamp?
WordCamp is a conference about everything WordPress-related. WordPress is a popular content management system (CMS) that runs millions of websites

One million people signed up to try the new ChatGPT powered Bing
Yusuf Mehdi, Corporate Vice President and Consumer Marketing Office at Microsoft, made the announcement on February the 9th of 2023