Ways to Check and Increase PHP Memory Limit In WordPress

If you are blogger and you use WordPress as blogging platform, there are chances that you will see an error which reads “Fatal Error: Allowed memory size of xxxxxx bytes exhausted” either in your browser or server logs. Wanna check your php memory limit? Wanna increase your php memory limit? I write this article for check your php memory limit and simple steps to increase php memory limit.

Usually, this happens when you install a new plugin, upgrade to the latest WordPress version or do other task.

The reason why you get this error is the insufficient memory allocated to WordPress and to get rid of this error you need to increase PHP memory limit of your WordPress blog.

In this post, I am going to teach you how to check and increase the default memory limit when it gets exhausted.

How To Check PHP Memory Limit?

The most common way to check the memory Limit for PHP scripts is to create a PHP file on your server like view-php-info.php and put the following code in it.

<?php phpinfo(); ?>

After creating this file on your server, simple open it in your browser e.g. www.yourdomainname.com/view-php-info.php . Here you will see a table list containing all configuration info about your current PHP environment (including memory limit).

PHP Memory Limit in WordPress

Another simple way to check the memory limit is to install a WordPress plugin called WP-Memory-Usage.

The plugin not only enables you to check the current memory limitbut will also show up the current memory usage and the PHP versionyou are using in the dashboard and admin footer.

How Much php Memory limit Do I need?

By default, the max memory limit for WordPress core is 32 MB but if you are using too many plugins on your WordPress blog especially the plugins that deals with images such as NEXTGenGallery, you probably need 64MB or more memory.

WordPress Memory Usages Overview

If you are unsure of how much memory you need, make use of WP-Memory-Usage Plugin and look out for the memory usage bar. If you find it RED try to increase the max memory limit until it shows up inBLUE color.

How To Increase PHP Memory Limit For Your WordPress Blog

You can easily increase your php memory limit by following below steps.

Increase Memory Limit via. php.ini

The most common way to increase memory limit is to edit the php.in file on your server. However, most small shared hosting servers won’t give you access to this file.

But if you have access to this file simply follow these steps:

  • Find the location of php.ini on your server by creating view-php-info.php file as mentioned above.
  • Search for “memory_limit” in php.ini and change its value to 64 M or 128 M. In case, there is no “memory_limit” found, add the following line at the end of php.in – memory_limit = 64M;
  • Save it and restart your Apache server with command line –httpd restart

Increase PHP Memory Limit  by edit your .htaccess File

A fresh WordPress Installation won’t have a .htaccess file so you need to create it yourself. In case you already have it for some reason just put the following line in it and save the file.

php_value memory_limit 64M

By adding this line in your .htaccess file the memory limit will now be 64 MB. In case, you want more just replace 64M with 128M and you’re done.

Change PHP Memory Limit in wp-config.php

If you don’t have access to php.in and you don’t want to mess with your .htaccess file, then this method would be the best for you.

In this method, you don’t need to create a new file. Just adding the following line in your “wp-config.php” file would increase your PHP Memory Limits to 64 MB.

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

PHP Memory Limit

Final Touches to ” Check PHP Memory limit/ Increase PHP Memory limit”

“Your Sharing is Our Caring”

Do you know any other ways of increasing PHP memory limit in WordPress? Do you have any problem to increase PHP Memory limit? Place a comment with your php memory limit.

3 thoughts to “Ways to Check and Increase PHP Memory Limit In WordPress”

  1. Pingback: Denny

Leave a Reply

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