Skip to content
How to Increase PHP memory to resolve the WordPress memory exhaustion error?

How to Increase PHP memory to resolve the WordPress memory exhaustion error?

For information on how to boost PHP memory and fix the WordPress memory exhaustion error, see this blog post:

 

Millions of websites use the well-liked content management system (CMS) WordPress worldwide. Unfortunately, occasionally WordPress may experience issues that prevent it from operating correctly. The WordPress memory depletion error is one such error that appears when the PHP memory limit is exceeded. We will talk about how to increase PHP memory in this blog post to fix the WordPress memory exhaustion error.

 

Step 1: Check PHP Memory Limit

Checking the existing WordPress site memory limit is the first step in upgrading PHP memory. Create a PHP file called “info.php” in the root directory of your WordPress website to accomplish this. Any text editor, such Notepad, can be used to generate this file. The code below should be copied and pasted into the file:

 

<?php
phpinfo();
?>

 

With an FTP program, save the file and upload it to the root directory of your WordPress website. the following URL into your web browser: http://yourdomain.com/info.php (replace “yourdomain.com” with your actual domain name). This will show a PHP information page with the available memory limit for PHP.

 

Step 2: Increase PHP Memory Limit

Once you are aware of the PHP memory limit, you can raise it by including a line of code in the wp-config.php file on your website. You can view this file through your hosting control panel or an FTP client by going to the root directory of your WordPress website.

Add the following line of code just before the line that reads “Activate” by opening the wp-config.php file “That’s all, no more editing. Happy blogging.”:

 

define('WP_MEMORY_LIMIT', '256M');

 

This line of code increases the PHP memory limit to 256 megabytes. You can adjust this value to a higher or lower number depending on your needs.

Save the wp-config.php file and upload it to the root directory of your WordPress site using an FTP client.

 

Step 3: Check if the Error is Resolved

Check to see if the WordPress memory exhaustion error is fixed after increasing the PHP memory limit. To check if the problem message is still present, go to your WordPress site. You’ve successfully increased the PHP memory limit if the issue is fixed.

You might need to speak with your web hosting company to raise the server’s PHP RAM limit if the error keeps occurring. It’s vital to check with your web host first because some might not let you increase the PHP memory limit through the WordPress dashboard or wp-config.php file.

 

Here are some additional details on how to increase the PHP memory limit in WordPress:

 

Step 1: Check Current PHP Memory Limit

You can make a new PHP file called “phpinfo.php” and upload it to the root directory of your WordPress website using an FTP client to view the current PHP memory limit. Finally, enter the URL for your website followed by “/phpinfo.php” to access this file using your web browser.

Look for the line that reads “memory limit” on the following page. This will show you how much PHP RAM is currently allowed on your WordPress website. You must raise the value if it is below what you require.

 

Step 2: Increase PHP Memory Limit via wp-config.php

You can add a line of code to the wp-config.php file in the root directory of your WordPress site to boost the PHP memory limit in WordPress. It’s crucial to make a backup of this file before making any modifications in case something goes wrong.

Add the next line of code to the wp-config.php file to raise the PHP memory limit:

 

define('WP_MEMORY_LIMIT', '256M');

 

The RAM limit is raised by this code to 256 megabytes, but you can change this figure to suit your needs. With an FTP program, save the file and upload it to the root directory of your WordPress website.

 

Step 3: Verify the PHP Memory Limit

You should make sure the PHP memory limit has been adjusted after making modifications to the wp-config.php file. To accomplish this, write the following code in a new PHP file called “check memory.php”:

 

<?php
echo 'Current PHP memory limit: ' . ini_get('memory_limit');
?>

 

Use your web browser to access this file after uploading it to the root directory of your WordPress website. This will show you how much PHP RAM is currently allowed on your website.

You have successfully increased the PHP memory limit for your WordPress site if the value shown corresponds to the memory limit you set in the wp-config.php file.

 

Step 4: Consider Other Factors

If you’ve followed the above steps and are still experiencing memory exhaustion errors, there may be other factors at play. For example, certain plugins or themes may be using up more memory than they should, or your server may not have enough available memory.

You might need to switch to a new theme or deactivate problematic plugins in these circumstances. To see if they can raise the amount of memory available on your server, you can also speak with your hosting company.

 

Conclusion

A key step in fixing WordPress memory depletion errors is raising the PHP memory limit. You may make sure that your website has enough memory to operate properly by following the above instructions to increase the memory limit via the wp-config.php file. more info Contact Us

 

Recommended Posts

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *

Shopping cart