Wordpress Tip: Increase PHP Memory Limit

Wordpress
Wordpress
Wordpress Out of Memory? Increase memory limit - many ways lead to the goal!

After I upgraded to Wordpress 3.5.2 today, when I called up the admin page “Edit Pages”, I got the message that there was not enough memory for the process. PHP usually reports this with a message like this: “Fatal error: Allowed memory size of 12.345 bytes exhausted (tried to allocate 345 bytes) in SCRIPTNAME”. This shows how high the current memory limit is set and by how many bytes it was exceeded.

I use the hoster allinkl.com for my [Wordpress Hosting->wordpress-hosting], which I can warmly recommend. My default limit there was 64MB – although it seems to have been set to 128MB on newer accounts. The 64MB is probably due to the fact that I have a fairly old account and a lower memory limit was set at the time. In principle, it doesn't matter, since you can currently set your limit up to 256MB with all-inclusive - and even a Wordpress that's extremely stuffed with plugins should be able to cope with that without any problems.

How high is my memory_limit set?

An easy way to find out how high the current value is with your provider is to install the Wordpress plugin "wp memory usage“. You activate this and then you get a line in the footer of every page in WP-Admin that shows how high the limit is and how much memory the call of the current page required. The display then looks like this: “Memory : 68.91 of 128 MByte”.

Error message after WordPress update?

The reason why you get such a PHP warning that the memory limit has been exceeded, especially after a Wordpress update, is that the software grows a bit with every update and gets more features. This means that the memory requirement of Wordpress increases from time to time, so that the limit is exceeded for certain processes. The good news is that the message mostly shows up first in the WP Admin and stays invisible to visitors in the frontend because the frontend uses less memory.

Fixed the error message by increasing the PHP memory limit

There are several ways to get rid of the error message. I would just like to introduce a few that raise the PHP memory limit:

Increase via the .htaccess file

In this case, simply use the FTP program to call up the ".htaccess" file, which is located in the root directory of the Wordpress installation. There you add the following line, which increases the memory to 128MB. If you need more, you have to adjust the number accordingly and use 256MB, for example.

php_value memory_limit 256M

With that the thing about the htaccess file is already done.

A little tip for people who use the [Allinkl-Reseller Hosting-> reseller-hosting]: To increase the memory limit for all domains, go to the main folder, in which all sub-folders of the domains are located. There you create a .htaccess file and insert the line mentioned above. This means that the limit for all sub-folders and thus for all other domains is also adopted.

Increase the memory limit via a plugin

Another easy way for plugin fans is to install the plugin”Change memory limit“. After installation and activation, you can set the limit directly – without having to change any PHP files or other files.

Adjustment of the memory limit via wp-config.php

Another way to choose is to modify the wp-config.php file, which can be found in the main WordPress directory. There you add this line to set the maximum memory requirement:

memory_limit=256M

This actually describes all the “easy” ways, of which at least one should usually work. If you don't have any luck with that, your host might not allow you to increase the limit and the above instructions won't work. If this is the case, you should rather contact the hoster directly to find out what you can do.

Did you like the article and did the instructions on the blog help you? Then I would be happy if you the blog via a Steady Membership would support.

5 Responses to “Wordpress Tip: Increase PHP Memory Limit”

  1. Pingback: Wordpress hosting - test my tip after 5 years »Sir Apfelot

  2. Hello and help,
    I have concluded a domain package with STRATO, whereby STRATO provides 120 sec. script time and 128 RAM in all packages.
    Now I would like to use the Avada theme and create a slider (font blocks come into the picture, the picture zooms out slightly ...) Below that are fields that rotate when the mouse is over - I would also like to incorporate this effect.
    Is that feasible with 128 RAM or do I absolutely need 256 RAM and am wrong with STRATO?
    A small webshop could be added later.
    According to the Internet, Avada needs the 256 RM and 300 seconds of script time for “classic demo content”. What is classic demo content?

    I hope you feel like writing to me, I'm a little desperate and have a customer on my neck ...

    Sincerely
    Your
    Fiona

    1. Hello Fiona!

      So with 128 MB RAM you can usually get there if you don't overload Wordpress with too many plugins. However, the script runtime and RAM can become "short" in the admin area if you make updates via the Wordpress admin. If necessary, you can also carry out these updates manually via FTP.

      But you don't have to worry as much about Avada. I had an old and a current version of it running on a domain with 128MB Ram and it worked fine for years. Because of the customer service and the server speed of Strato, one could rather start pondering. If you want recommendations for good (!) WordPress hosting, get in touch again. :)

  3. Hello Sir Apfelot,

    Thank you very much for your quick and detailed answer! Now you've got me hooked: Who has good WordPress hosting and good customer service?

    I'm looking forward to your answer!

    Fiona

    1. Hi Fiona!

      Well, then I'll give you my tip:
      It's the guys from Raidboxes.de.

      The hosting is 10-25 EUR (depending on which package you take), not the cheapest, but it has some advantages that I really appreciate:

      1. Faster (nice!) German-speaking support

      2. Each Wordpress is encapsulated from other installations with a vServer (which has the advantage that domains that are on the same hosting cannot (or only with great difficulty) infect each other with malware

      3. They have SSD hosting, which makes page loading extremely fast and loading time extremely short

      4. They have built-in server-side caching so that you don't have to deal with complex caching plugins

      5. The WordPress core data in the hosting is write-protected, so that even if a hacker should come to the domain, he cannot change any WordPress data and infect it with malware

      6. For larger packages, support takes care of WordPress and plugin updates themselves

      Especially these hacker things should not be underestimated in Wordpress. It is the CMS that is most widely used and is therefore a popular target for hackers. Personally, I have had to clean up several times hacked Wordpress pages from customers or from me on other hostings because some hacker had smuggled in his malicious code. I have been hosting Raidboxes with several customer domains and my own pages since mid-2015 and not a single one of them has been hacked.

      From my point of view, their hosting is the all-round carefree package if you prefer to take care of your blog content than the technology. And if you already have your WordPress site somewhere else, then they bid a free moving service (I've already used it several times!).

Post a comment

Your e-mail address will not be published. Required fields are marked with * marked

In the Sir Apfelot Blog you will find advice, instructions and reviews on Apple products such as the iPhone, iPad, Apple Watch, AirPods, iMac, Mac Pro, Mac Mini and Mac Studio.