How you solve a WordPress memory error

RazielKanos13. December 2020

3 min read

01

WordPress Memory Whats it good for?

WordPress is just software running on a computer, just like your Windows or Mac or Linux applications. To be able to do certain opperations it needs access to the RAM memory of your server. But by default, the basic setting for the memory usage are very limited. It can happen that you run into problams and get an error message like this:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx

The same can happen if you try to install larger plugins. Your servers php runns out of time to extract the zip file, because there are too many files in it. In this tutorial we will teach you how you can handle these issues and make sure that your WP runns smooth an fine 🙂

We will show you three ways to increase your WordPress memory limitation – you just have to do one of the usually. Start wil the first trick, and if it does not work, work your way down the list.

02

Edit the .htaccess

The htaccess file is a very important file to manage the settings for your server session. It is stored in your root installation folder of your wordpress. You need an FTP editor to make changes, or a plugin that allows to you edit the htaccess. Carefull what you do to this file, cause it can cause your whole WP page to crash!

Editing the htaccess file should work on most hosters. I know there is a rare breed that don't allow changes, so once you edited the file, check from an incognito window if you website is still rendering. If not – no reason to panic, just delete the changes you just made, reupload or save the file, and all is back and good 🙂

Copy this line as the first line of the file:

php_value memory_limit 1024M

03

Edit wp-config.php

The wp-config.php store all vital information your WordPress needs to run. Making changes here is no guarantee that they will work. For example, if you are limited on the server level to 64MB Ram, and you make changes here to 256MB it still would be limited to the 64MB your server is grating. Editing the htaccess therefor usually is the better way, since you force the server to gibe your wordpress more RAM

like the htaccess file, you find the wp-config.php in the root folder of your Worpress installation. You need to download and reupload it via FTP or use a plugin that allows you to edit these files.

To make the changes, just copy this line of code at the end of your wp-config.php file:

define('WP_MEMORY_LIMIT', '1024M');

04

edit php.ini

This one is tricky, because every hoster lets you edit the php.ini differently, if you can edit it at all. Thats why this is our last trick on the list. Sometimes you have access to some values through a dashboard, sometimes you can edit the file directly. So you have to apobt want we say now to your situation.

search for the term "memory_limit"

change the value to 1024M

If you are not able to locate "memory_limit" just copy the next line somewhere into the php.ini. The location where you drop that line does not matter:

memory_limit = 256M

Do not end the line with a comma or anything else you might be used of from CSS or other languages

05

Questions?

Any questions left? Post them here so i can aswer them to you 🙂

Also you should totally join our amaging community 😀

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x

Hey!

Would you like to know what I am currently working on?

We use cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Click to learn more