How to increase WordPress php memory limit
How To Guide

How To Increase PHP Memory Limit in WordPress

If your seeing an error relating to your WordPress PHP memory limit, fear not! It’s not the end of the world and this article will show you how to fix it.

It’s quite a common error to see. Well, actually it’s one of the most common errors you’ll get in WordPress. Don’t worry, it’s a really simple fix, even for non technical blog owners.

You can fix it by increasing the PHP memory limit. As I explained, I’ll show you how to fix it and get your blog back up and running. I’ve written other useful articles about WordPress, including an in depth article on how to prevent your WordPress site from getting hacked.

Table of Contents:

  1. What is the WordPress PHP Memory Limit error
  2. How to check your current PHP memory limit
  3. Fixing the PHP Memory Limit Error

What is the WordPress PHP Memory Limit Error

Before you understand what the PHP Memory Limit Error is you need to understand a little about WordPress. ust like any other computer software, WordPress needs memory or RAM to run effectively. At it’s core, WordPress runs on PHP. PHP is a powerful programming language and it’s very powerful. PHP needs a memory limit so it knows how much memory each script is allowed to consume. Just like you have a speed limit on the motorway for each car, the PHP limit is on a per script basis. 

If you want to learn more about it you can check out an awesome PHP blog

The memory limit is the maximum size of server memory an individual PHP script can use. If one of your scripts reaches this defined limit you’ll see an error that looks like this:


2. Checking your Memory Limit

Checking your memory limit depends on if you are self hosting your WordPress instance or not. I’ll show you how to check it using CPANEL and checking the raw files.

Checking CPANEL:

  1. Login to your server
  2. In the Search Bar type ‘PHP’
  3. Select ‘MultiPHP INI Editor.
Go to MultiPHP INI Editor
Go to MultiPHP INI Editor

Select MultiPHP INI Editor
Select MultiPHP INI Editor

Checking php.ini file:

  1. Login to your server.
  2. Locate your php.ini file.
  3. Open in text editor.
Select your php.ini file.
Select and then open your php.ini file.
PHP.ini file example.
PHP.ini file example, here you can see memory_limit = 256m. To Fix it, read below:

Increase WordPress PHP Memory Limit

Fixing the error as I’ve already mentioned, is really simple. All you need to do is change the memory_limit value on your server to something a lot higher! How high should you change it? It’s not a one size fits all answer I’m afraid. A limit for one site may not work for another. I’ve set CodeWithMikes’ memory limit to 256MB. You can set yours to a similar figure. Once you’ve  changed it you’ll be able to refresh the page that was erroring and it should work.

The memory_limit = 256M code tells the web server that the memory limit should be 256mb.

Before changing any values it’s important you make a backup of your WordPress site so you can roll back the change should anything go wrong! You can take a backup using the backup functionality in your CPANEL account or ask your hosting provider. Alternatively you can use a plugin! If you do use a plugin be sure it will securely handle your data, especially if it contains personal data of customers or users of your blog.

BONUS: Video How To Guide:

If you need a more visual guide to help you fix this error, check out this YouTube video, it’ll help you resolve the issue:

Leave a Comment

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