Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 122880 bytes)
Asked Answered
A

8

25

I have two domains, webhosted on 000webhost. I installed wordpress on them and for some days it functioned well, but now it shows me the following error on both of them:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 122880 bytes)

The source of the error ("in...") is never the same (it always changes).

I found that this error is common, but here I don't have a php.ini file. I understood that I should change the wp-config file. Well, here's the catch: how should I do this? I understood that I should add

define (‘WP_MEMORY_LIMIT’, ‘...M’); // increase limit to ..M" (adding 64, 96 or 128) 

[thanks to http://www.dummies.com/how-to/content/optimizing-the-wordpress-configuration-file.html]

I'm not good at programming (just a newbie who wants his own domain), can you help me? Please there me EXACTLY where to put the function. If this is not how to solve the problem, please offer me another solution. I am quite in a great need of help :)

I can't post the file here (it seems I don't format it well), but I can explain the structure:

  1. introduction: "* The base configurations of the WordPress. [...]
  2. After that, MySQL data.
  3. Then, "Authentication Unique Keys and Salts."
  4. "WordPress Database Table prefix"
  5. "WordPress Localized Language, defaults to English"
  6. "For developers: WordPress debugging mode"
  7. " That's all, stop editing! Happy blogging."

So, where should I introduce the define function (if in this file, where?), if in another, which and where?

Aloysia answered 23/7, 2013 at 18:24 Comment(6)
Edited. Could not post it, wrote only the structure.Aloysia
It seems that someone had the same problem, but for him it worked: 000webhost.com/forum/customer-assistance/…Aloysia
Why can't you post it?Lynea
Also, if you need that much memory, something is wrong.Lynea
Joachim Isaksson answered below that the .htaccess is the one I had to edit, not the .config file. For the moment, it works (for one domain). For the other, I am making now the edit, se if it also works here.Aloysia
It also worked for the second domain.Aloysia
F
25

For 000webhost, you should be able to override php.ini values using a .htaccess file stored in your public_html.

I'm not sure what values they allow you to override, but to raise the memory limit to 128M (the standard, I presume it was lowered to 64M), try putting this in .htaccess;

php_value memory_limit 128M
Footton answered 23/7, 2013 at 18:32 Comment(0)
E
23

If you don't have access to php.ini and updating .htacess file gives you Internal Server Error you could try to add this line in wp-settings.php

ini_set('memory_limit', '128M');
Extrabold answered 19/12, 2015 at 16:52 Comment(0)
A
8

Changing the memory limit only hides the problem, it doesn't solve it.

You currently have 64MB of memory, which should be more than enough for your needs. If it's not, then there's almost certainly a leak in your code, or possibly an infinite loop.

Instead of trying to hide the error in a corner, try fixing it. Look at where the error happens, see if you can find what the "last straw" is that makes it exceed the memory limit.

Argos answered 23/7, 2013 at 18:28 Comment(2)
That's the problem: it happens everywhere. It always shows me a different location. If it pointed me a single place, I know, it would have been easy!Aloysia
The standard memory amount for PHP is 128M, but 000webhost lowers it by default to 64MB. Parts of WP do not like the lower limit (and no, I'm far from defending WP or in this case probably its plugins for doing this :) )Footton
T
5

GoDaddy seems to reduce the memory_limit value to 64M by default.

I had spend a day or two trying to increase the size, by changing the .htaccess file and php.ini file in the /public_html folder. But atlast I got the issue resolved as follows:

  • Logged into Control Centre
  • Opened CGI Admin > PHP
  • Opened the phpmyinfo of my PHP version in the page (4 & 5 were shown, and mine was PHP5)
  • On the first line, there is a note specifying that "the configuration shown is not from the user's php5.ini file". Guessed the ini file to be php5.ini and not php.ini
  • Created a new file with all the configurations copied from the php.ini file in the root folder, and named it php5.ini
  • Added a new line memory_limit = 128M
  • Uploaded it to the root folder (/public_html) and it worked.
Toscano answered 6/10, 2014 at 10:22 Comment(0)
S
3

its well-known error easy to solve just do simple editing wp-config.php file First, open your wp-config.php which is located in the root WordPress directory. Then add the following line inside the main php tag: define('WP_MEMORY_LIMIT', '64M'); or change 64M to your need.

Scottscotti answered 9/12, 2016 at 12:59 Comment(0)
W
3

If you are using GoDaddy you should check which php version is your hosting running.

Happened to me that I was running 5.2 when the latest available was 5.4.

You just have to log in to the hosting manager and check the version in Programming Languages.

enter image description here

Wallen answered 23/2, 2017 at 16:18 Comment(1)
This did the trick for me. Be prepared, GoDaddy will prompt with a warning that "Upgrading to PHP 5.4 might cause compatibility issues with code on your site." Not that it matters, as the site is already crashing with memory allocation errors anyway. Cheers.Inellineloquent
W
0

I turned off plugin AMP, sovled.

Wellgroomed answered 15/9, 2022 at 23:41 Comment(0)
T
-1

Go to wp-config.php file and put this code right under the very 1st php line (so this code will go on line 2 and 3)

//increase WP Memory Limit    
define('WP_MEMORY_LIMIT', '256M');
Tocantins answered 5/10, 2016 at 9:16 Comment(1)
This worked but you should be careful using more than 128M, if you need more than that something is wrong with your code.Maclaine

© 2022 - 2024 — McMap. All rights reserved.