Search code examples
php.htaccessmagentomemory

Why do I get a Fatal Error out of memory in Magento?


Often when I try to add something to my cart or try to checkout I get the following error:

Fatal error: Out of memory (allocated 247463936) (tried to allocate 261900 bytes) in /home/users/domain/domain.com/webshop/lib/Zend/Db/Select.php on line 421

This only just started today on two Magento webshops I'm working on.

I've done some research on the error - the memory_limit in .htaccess of Magento was already set to 256M. I've tried commenting this out and keeping it on and also been checking out the php_info(); function and this says that memory_limit is set to 256M.

This error is getting quite frustrating so help would be appreciated.


Solution

  • Instead of changing your memory limit in htaccess you should do it in in the php ini file.

    Look for this line: php_value memory_limit

    If you are on a shared host, you may find that they have to help you with this. If you are on a shared host, good luck :) I've found running a shopping cart was nightmare on every shared host I've ever tried it on. Worth the extra bit a month for a VPS at least.