Posted on November 2, 2016

How to Increase the PHP Memory Limit for WordPress

WordPress sets a default PHP memory limit during the installation process and there are times when you might need to increase this limit. Instances when this might happen include error diagnosis, and plugin or theme installation. For example, you might be getting the white screen of death or another error which is occurring because of a lack of memory.

In other instances, some themes and plugins may require WordPress to have access to more memory than is currently available. In both situations, you should increase the PHP memory limit.

Depending on your hosting, you may not be able to increase the memory size. Many shared hosts limit the amount of memory used by WordPress and some may not allow you to increase the PHP memory limit. Before you do anything, you should speak to your hosting provider first. If they do allow you to increase the PHP memory limit, they may even do for you. At the very least, they can advise you about the maximum limit allowed in your plan.

What to Set Your PHP Memory Limit to?

If you have a problem with WordPress, you should search the internet to and try to diagnose your issue. Assuming that a lack of memory is causing the problem, you can increase the limit until the issue is resolved.

On the other hand, if you need to increase the memory limit for a plugin or theme, then the developer should be able to tell you the amount of PHP memory required.

Three Ways to increase the PHP memory limit for WordPress

There isn’t only one way to achieve a PHP memory increase with WordPress. There are three options available. You must complete the first option and either one of the second options may or may not work for you. In some instances, option number two will work and in other cases, option number three will work. It may be that neither option actually increases the memory limit and you’ll need to contact your hosting provider.

1. Edit wp-config.php

You will need to complete this step before doing anything else. The wp-config.php file tells WordPress how much memory it’s allowed to use. Even if your server is set to a higher amount, the wp-config.php can still limit the amount used by WordPress. Therefore, before you do anything, you need to increase this limitation.

Open your wp-config.php file which can be found in the root directory of your WordPress installation. Search for a line which says:
define(‘WP_MEMORY_LIMIT’, ‘128M’);

In some cases, the limit will be set to different amounts. Simply edit the number before the M (Megabytes) to the desired amount. If your wp-config.php file doesn’t contain this line, you can add it yourself at the end of the file.

2. Edit php.ini

If you have access to the php.ini file on your server, you can edit it to increase the memory allocation. Some hosting providers and plans don’t provide access to the php.ini file. If this is the case, you should skip this part and move on to editing the .htaccess file below.

3. Edit .htaccess

If you don’t already have an .htaccess file, you can create one in notepad by saving an empty file name and using the .htaccess extension. If you already have an .htaccess file, then you can just add the following line to the top:

php_value memory_limit 128M

This line of code will increase your memory limit to 128MB.

Before you do anything, you should check that your hosting provider allows you to increase PHP memory limits. Then the next thing you need to do is edit the wp-config.php file to tell WordPress how much memory it can use.

You then need to ensure that your server can provide that amount of memory by editing the php.ini file. Some hosts don’t always provide access to the php.ini file. Alternatively, if you can’t edit your php.ini file, or it doesn’t seem to have any effect, then you should edit your .htaccess file.

If none of the above has worked, you will need to contact your hosting provider and ask them to help you. It may be that on your current hosting plan, you can’t increase memory allocation. In some cases, the support team has to do it for you.

Leave a Reply

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

Trusted by Clients Across All Industries

Don’t take our word for it - let our happy clients do the talking. See More

Full Host did an amazing job of migrating my site seamlessly onto their server. My only regret was not switching my site over to them sooner. Now it is performing great, images are uploading way faster than ever before.

" Vancouver Sofa and Patio - Jerry Schmidt

Two thumbs up for Fullhost! Agents reply to me fairly quickly or at least let me know they received the ticket and are looking into it. Kudos to the support team as they have always given me exactly what I need without delays.

" Universal Staffing Inc. - Anthony Calvano

FullHost is an absolute pleasure to work with, and their customer service is exceptional. Whenever I have questions or need adjustments, they are there to help, quickly, efficiently, with answers and insights.

" Mooseworld Inc. Norine Leibel

The Fullhost team was a huge help in getting the website moved over and set up in a way in which we could correct the technical issues. They were quick, helpful and technically knowledgeable.

" Canadian Sport Institute Pacific Noah Wheelock

Our organization Has been working with FullHost for a couple of years now, and we have been thrilled with the service.

" Canadian Centre for International Justice / Philippe Kirsch Institute Pearl Eliadis

Exceptional is the word when it comes to FullHost. I started my own business and in the jungle of applications, licenses and registrations, FullHost had my back.

" Statsmen Matthias Bass

The customer service and support staff that I have dealt with have all been great. The move from my previous host was smooth thanks to the support staff at Full Host who moved my files over.

" Moose Web Design - Michelle Nortje

With coast to coast coverage,
We help you serve the world.

Whether your audience is located in Europe, Asia, Africa, or Australia, provide them with lightening speed!

FullHost's data centers are located in Toronto and Vancouver to ensure worldwide quality and speed.

Get in Touch
We Trust Only The Best Tech to Support You

FullHost operates with the most innovative technology to bring you unparalleled levels of hosting services.