Fix: WordPress Memory Exhausted Error – Increase PHP Memory(4 Methods)
What is WordPress Memory Exhausted Error?
WordPress Memory Exhausted Error is an error message that appears on your WordPress website when your website’s code requires more memory than what is allocated by default.
WordPress is built on PHP, which is a server-side scripting language that requires memory to execute code. PHP scripts can be memory-intensive, and if the amount of memory allocated to PHP is not sufficient, it can cause the website to crash or display the error message.
WordPress has a 32MB memory limit by default, but some hosting providers increase this to 64MB for all customers. But at eHostingServer, you can extend your memory limit to up to 2 GB in all of our plans.
In this blog, I will show you how to solve the “WordPress Memory Exhausted Error” and the causes of this error.
How to Check Your Current PHP Memory Limit?
To check the current PHP memory limit of your WordPress website, there are several methods, and you can use one of the following methods:
Here are the steps you should follow if you want to check the memory limit of your WordPress.
STEP 1: Login to your WordPress Admin Dashboard. If you don’t know how to install wordpress you can check our blog https://www.ehostingserver.com/how-to-install-wordpress-on-cpanel/.
STEP 2:On the left, at the button, you see “Tool.” Click on that, and you will see a lot of options; among them, select “Site Health.”

STEP 3: Select the Info Which contain the information .

STEP 4: When you select the information at the bottom, you will the server and click on it.

STEP 5: You can view all of your WordPress’s details here.

What Causes the “WordPress Memory Limit Exhausted” Error?
1) Too many active plugins: Each plugin you add to your WordPress site requires memory to function. If you have too many active plugins, they can quickly consume your available memory.
2) Heavy media files: Large images, videos, and other media files can take up a lot of memory. If you have a lot of media files on your site, they can quickly eat up your available memory.
3) Poorly optimized code: If your theme or plugins have poorly optimized code, they may consume more memory than necessary. This can be especially problematic if you’re running custom code or third-party plugins that haven’t been updated recently.
4) Low server memory limits: If your server has low memory limits, you may run into memory errors more frequently. This can be a problem if you’re on a shared hosting plan or if you have limited resources available.
Ways to solve the WordPress Memory Exhausted Error – Increase PHP Memory
Method 1: Using wp-config.php file.
The wp-config.php file is an important file used in WordPress installations. It contains configuration settings that are necessary for WordPress to function properly.
Follow these steps to change the Increase PHP Memory:
STEP 1: Login to cPanel.
STEP 2: Go to the Files -> Select File Manager ->Select Public_html.

STEP 3: After that select the wp-config.php. Select Edit.

Next, you need to paste this code in wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’ I have increased the memory limit to maximum that is 2G.
define( 'WP_MEMORY_LIMIT', '2G');

After saving the changes, clear your browser cache and refresh your website. The “Allowed Memory Size of Bytes Exhausted” error should be gone.
Method 2: Using Select PHP version.
Follow these steps to change the Increase PHP Memory:
STEP 1: Go to the Software section of cPanel there you see Select PHP Version.

STEP 2: After you select that option, choose the Options section, where you can see the options to change.

STEP 3: From here you can change the memory_limit option up to 2G.

STEP 4: Also you can change the post_max_size to 2G.

STEP 5: You can increase the upload_max_filesize .

After saving the changes, clear your browser cache and refresh your website. The “Allowed Memory Size of Bytes Exhausted” error should be gone.
Method 3: Using MultiPHP INI Editor.
The php.ini file is a configuration file used by PHP, a popular server-side scripting language used to create dynamic websites and web applications.
The php.ini file contains various settings and configurations that can be customized to meet specific needs of a PHP application.
STEP 1: Go to the Software section of there you can see MultiPHP INI Editor.

STEP 2:Select the domain name for which you want to make changes.

STEP 3: Now you will see all the information you can change according to your requirements. You can change it from here.

Method 4: Using .htaccess file.
The .htaccess file is a configuration file used by the Apache web server to control the behavior of a website or a specific directory within a website. It stands for “hypertext access,” and is often used to define rules for URL rewriting, password protection, and other server settings.
STEP 1: Login to cPanel.
STEP 2:Go to the file section. Select file manager.
STEP 3: Choose Public_html and then the .htaccess file. If you have difficulty, you can go to the settings and select “hidden files.”

STEP 4: Now, select the .htaccess file and press the Edit button.

STEP 5: After that Look for the line:
# END WordPress
Add the following code :
php_value memory_limit 2G

STEP 7: Save the file and close the editor.
After saving the changes, clear your browser cache and refresh your website. The “Allowed Memory Size of Bytes Exhausted” error should be gone.
Conclusion
In conclusion, if you encounter the “WordPress Memory Exhausted Error” while using WordPress, increasing the PHP memory limit can be a quick and effective solution. This error occurs when WordPress is unable to allocate enough memory to run a script or a plugin. By increasing the PHP memory limit, you are giving WordPress more resources to work with, which can help prevent this error from occurring in the future.
To increase the PHP memory limit, you can edit your site’s wp-config.php file or the .htaccess file, or contact your web host to increase the limit for you. However, keep in mind that increasing the PHP memory limit is not always the best solution for every situation, and there may be other factors contributing to the error that should be addressed as well.
I hope this information helps you how to solve WordPress Memory Exhausted Error . If you find any difficulty then you can contact us through a Support Ticket or live chat. We are there for you.