How would you increase the PHP memory limit

How to increase the PHP memory limit in WordPress

In order to explain the PHP memory limit simply, I have to put it in a comparison: You can think of it like the RAM of your computer.

It indicates how much memory a Script is allowed to use the maximum and it has absolutely nothing to do with the storage space that your images fill, for example!

Since WordPress & Plugins are based on PHP, this PHP memory limit is very important for smooth processes on your WordPress website.

Table of Contents

When to increase the PHP memory limit

In my article on typical WordPress problems, I already described increasing the PHP memory limit as a possible solution to the white screen of death and problems with image uploads.

But there are also plugins that do not work or not work properly without a certain PHP memory limit. For example, there is an extra status page in WooCommerce that shows you whether all requirements are met. If the PHP memory limit is too low here, it looks something like this:

If a script cannot be executed and the PHP memory limit is to blame, then an error message like this can also appear:

In all of these cases it is necessary to increase the memory limit.

This is how you can check the current PHP memory limit in WordPress

As you can see in the screenshot above, some plugins show the PHP memory limit.

WordPress itself also has a function for this under “Tools” -> “Website status” -> “Report” -> “Server”.

How to increase the PHP memory limit

There are several files in which you can enter the appropriate code to increase the limit:

  • wp-config.php (my recommendation)
  • .htaccess
  • php.ini
  • contact your hoster

All three files are located in the main directory of your WordPress installation, which you can access via FTP.

[Recommendation] Increase PHP memory limit with wp-config.php

I recommend you to adjust the PHP memory limit via the wp-config.php file!

You can find the wp-config.php file in the main directory of your WordPress installation.

So log into your server via FTP and open wp-config.php.

Scroll down a bit to the part of the code where it says:

/ * That's it, stop editing! Have fun blogging. / / That's all, stop editing! Happy blogging. * /

About that insert the following code:

Increase PHP memory limit with .htaccess

The .htaccess is a powerful file, so you have to be careful what you do!

You can also find this file in the main directory of your WordPress installation. However, it is a "hidden" file, which is symbolized by the dot in front of the name. You have to allow hidden files to be displayed in your FTP program, otherwise you will not be able to see them.

Enter the following code at the end of the file:

Increase PHP memory limit with php.ini

With the php.ini file you can make settings on your server. Among other things, you can also increase the PHP memory limit here.

As with .htaccess, you can break a lot with this file, so be careful! Not every hoster provides you with a php.ini file (one of the reasons why I recommend the setting via wp-config.php).

If you do the increase via the php.ini, insert the following code:

Contact your hoster

Of course, you can also contact your hoster's support. The good hosts will help you increase!

Simply ask the support representative to increase the PHP memory limit for your website.

Before you go…

How about…

  • ... when you get answers to all of your questions continuously?
  • ... if you always get the solution for your current hurdle?
  • ... when you are connected to people who are facing the same challenges and problems?

Sounds great, doesn't it?

I have built a members area for WordPress beginners and advanced users, where a community of fantastic people turns the daily battle with WordPress into fun.

In an exclusive forum you will receive answers to your questions, inspiration, tips and, above all, the motivating certainty that others are like you too!

I learned more from Jonas in 10 days than in the previous 3 years that I was dealing with WordPress!

Christine Lindner - Member of the WP Ninjas Dojo member area

In addition, there are webinars every month on certain focus topics and co-workings, in which you are in contact with me live throughout the day in order to get your questions about WordPress answered immediately. Many members now use this co-working day to do all WordPress work.

Membership costs only € 67 net per month and of course there is no minimum term, you can withdraw at any time!