Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Before reply please read scenario on Magento 1.8.X

command

php  indexer.php --reindex all
Product Attributes index was rebuilt successfully
Product Prices index was rebuilt successfully
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 128 bytes) in  /home/zeleyane/public_html/naturjoya.com/lib/Varien/Object.php on line 117

Information PHP

php -i | grep memory
memory_limit => 512M => 512M
Collecting memory statistics => No
suhosin.memory_limit => 0 => 0

Try put on index.php

ini_set('memory_limit', '512M');

I think there're any file of magento with limit 512M.

Try looking for 256 or 268435456 on files, I don't see a correct file.

share|improve this question
up vote 9 down vote accepted

The problem comes from .htaccess. One of the values is php_value memory_limit 256M. This doesn't make sense on the first view, but on the second it is explainable.

I don't know why magento implemented this idiot thing, but what happend is, the following method reads the information from .htaccess and processes them:

\Mage_Shell_Abstract::_applyPhpVariables
protected function _applyPhpVariables()
{
    $htaccess = $this->_getRootPath() . '.htaccess';
    if (file_exists($htaccess)) {
        // parse htaccess file
        $data = file_get_contents($htaccess);
        $matches = array();
        preg_match_all('#^\s+?php_value\s+([a-z_]+)\s+(.+)$#siUm', $data, $matches, PREG_SET_ORDER);
        if ($matches) {
            foreach ($matches as $match) {
                @ini_set($match[1], str_replace("\r", '', $match[2]));
            }
        }
        preg_match_all('#^\s+?php_flag\s+([a-z_]+)\s+(.+)$#siUm', $data, $matches, PREG_SET_ORDER);
        if ($matches) {
            foreach ($matches as $match) {
                @ini_set($match[1], str_replace("\r", '', $match[2]));
            }
        }
    }
}
share|improve this answer
1  
a lot of thanks. I don't know this stupid limit on .htaccess... Also see any files on magenta with 256M limitations... incredible. – Abdel Karim Mateos Sanchez Oct 8 '14 at 20:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.