Ways to Check and Increase PHP Memory Limit In WordPress

If you are a blogger and you use WordPress as the 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 tasks.

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 the 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 exhausting.

How To Check WordPress PHP Memory Limit?

check php memory limit

Here have two ways to check your WordPress memory limit. Both ways are very easy for check memory limit of WordPress.

1. Steps to check php memory limit of wordpress:

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, simply 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 limit but will also show up the current memory usage and the PHP version you 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

There have four method to increase Php memory limits of your WordPress website. This methods are really gonna help you to increase your WordPress memory limit. You can easily increase your php memory limit by following below steps.

  1. Increase Memory limit via php.in
  2. change your php memory limit via .htaccess file
  3. change php memory limit in wp-cofig.php
  4. Contact to your Hosting Provider.

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

Contact to your Hosting Provider

If you are unable to increase your allowed php memory of your WordPress by upper given tips to increase php memory limits of WordPress then you have to contact you hosting provider and talk abut your problem to those.

So if those method to change php memory limit of WordPress are not comfortable for your WordPress website then you have talk to your hosting provider to maximize your php memory limit.

By the way the upper given solution to increase memory limit of WordPress are work for every one but some times those hosting provider are stop you to increase WordPress memory limits.

This is the last solution for increase WordPress memory limits, So contact to your hosting provider and I am dam sure they will really gonna help you to maximize your WordPress memory limits.

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”

Leave a Reply

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