How can i solve Magento Out of memory Fatal error?

2019-09-16 07:08发布

问题:

Magento 1.9.x with xampp-win32-7.0.4 showing following type error randomly

Fatal error: Out of memory (allocated 14680064) (tried to allocate 790528 bytes) in lib\Less\Parser.php on line 3719
Fatal error: Out of memory (allocated 134217728) (tried to allocate 16384 bytes) in lib\Varien\Image\Adapter\Gd2.php on line 74
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 16384 bytes) in lib\Zend\Db\Statement\Pdo.php on line 228

I try as following link but nothing happen

https://indiestechtips.wordpress.com/2012/10/13/magento-fatal-error-out-of-memory-allocated-14680064-tried-to-allocate-1245184-bytes/

回答1:

You could try to increase the memory limit to 512 in your Magentos root folder .htaccess. Just find the following lines and adjust the value for memory_limit:

<IfModule mod_php5.c>

    ############################################
    ## adjust memory limit

    php_value memory_limit 512M

If you still run out of memory, there might be another problem in your Magento installation that consumes so much.



回答2:

add this code to index.php

ini_set('memory_limit', 256M);

If the problem still comes increase the limit.