The Best Free WordPress Tutorials to Master WordPress

How To Increase The WordPress Memory Limit

0 567

Sometimes while installing or updating a new plugin or running some CPU monster plugins, you may get a memory limit error. WordPress memory limit error usually looks like this;

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home8/xyx/public_html/wp-includes/plugin.php on line xyx

The reason you are getting this error is because your site has exceeded the default memory usage limit. In this article, I will tell you how to increase the memory limit step by step.

How To Find Out What Your Site’s Memory Limit Is

First of all, we need to find out how many MB the memory limit of your website is. In this method, which is most used to learn the memory limit limit;

Create a new file called view-php-info.php on  your server and add the code below to the file you created.

<?php phpinfo(); ?>

- Advertisement -

After creating your new file, go to the url address of the file you created from your browser, that is,  http://www.yoursite.com/view-php-info.php  url.

When you go to the address, you will see a long table as seen in the picture below. Search for the memory_limit tab from this table . The value displayed is the current memory limit of your site.

Learning WordPress Memory Limit

Another way to learn the Memory Limit is  to use the WP-Memory-Usage  plugin. This plugin not only shows the memory limit limit, but also shows your memory usage and the php version you are using.

How Much Memory Do You Need?

The memory limit that WordPress assigns by default is limited to 32 mb  . If you use too many plugins or have high traffic, your site may need 64mb  or higher memory limit usage.

If you’re not sure how much memory you need, it’s a good  idea to use the WP-Memory-Usage  plugin. After installing and running the plugin, look at the Memory Usage tab. If the memory usage barRedIf so, you need to increase the memory limit limit.

How to Increase WordPress Memory Limit

Increasing Memory Limit Method 1 (Via Config.php File)

First of all, connect to the server of your WordPress site via FTP and open the wp-config.php file in the root directory and add the code below.

define('WP_MEMORY_LIMIT''64M');

Yes, we’ve increased our memory limit from 32mb used by default to 64mb . The memory limit error will disappear after performing this operation.

Increasing Memory Limit Method 2 (via .htaccess File)

Connect to your .htaccess file  via FTP  or cPanel and add the following line into your .htaccess file.

php_value memory_limit 64M

By adding this line to the .htaccess file, we have increased the default 32mb memory limit to 64mb .

Increasing Memory Limit Method 3 (Via Php.Ini File)

Many hosting companies prevent their users from accessing  the php.ini file (especially those using shared hosting  ). If you have permission to access your php.ini file, you can apply the method below.

As I explained above  , create a new file called view-php-info.php  on your server and this time search for the ” Loaded Configuration File” tab. You can find the location of your php.ini file here.

Finding WordPress Php.ini File Location

After knowing the location of your php.ini file, log in to the file and  change the 32mb memory limit to  64mb or 128mb . If your php.ini page does not have a memory_limit tab, the page will end with  memory_limit = 64M; Add the phrase. After adding, save and restart your Apache server  with the httpd restart  command.

Important: If you still get this error after performing these steps, please contact your host company.

- Advertisement -

You might also like
Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More