Pergunta

I'm trying to reindex my catalog_url_rewrite table (Magento website) through the command line using the command "php indexer.php --reindex catalog_url" in /shell. I get the following error:

PHP Fatal error:  Maximum execution time of 60 seconds exceeded in /var/www/domain.com/lib/Zend/Db/Statement.php on line 141

The file and line on the error varies.

I've double checked to confirm that php in the command line is indeed using the php-cli version (by using "php -i") and that there are no limits in its config that should yield such an error.

I've also looked around to see if any magento file is setting the "set_time_limit" manually, but couldn't find anything that points that way. I can't find the 60 seconds max_execution_time anywhere.

Any idea on what's going on?

Edit:

So far I've tried:

  • Running "php -d max_execution_time=0 indexer.php --reindex catalog_url"
  • Setting "set_time_limit(9000);" on indexer.php directly.
  • Running "php -i" to see "Configuration File (php.ini) Path => /etc/php5/cli" & "Loaded Configuration File => /etc/php5/cli/php.ini"
  • Setting max_execution_time on fpm's php.ini to 61 just to see if it was using it by accident.
  • Made sure "set_time_limit(60)" is not hardcoded anywhere in the magento framework.
Foi útil?

Solução

I've run into this. The issue is that shell scripts extending Mage_Shell_Abstract inherit behaviour that applies PHP ini settings parsed from Magento's .htaccess file.

Take a look at the method protected function _applyPhpVariables() in shell/abstract.php.

Easiest fix, is to just edit .htaccess and comment out the php_value directives for execution_time and or memory_limit. Alternatively you can extend the indexer by overriding the applyPhpVariables() method and stop it processing the .htaccess.

I made sizeable donations to my swear jar when I first discovered this 'feature'.

Outras dicas

Try running this from the root of Magento installation:

php -d max_execution_time=0 ./shell/indexer.php --reindex catalog_url

If this command fails with that same error, then something crazy is going on. :)

One thing to point out is that Magento shell commands parse the htaccess file and will apply settings (such as time limit) that it finds. I would check your htaccess file.

See this post I wrote a while ago: http://edmondscommerce.github.io/magento/magento-shell-scripts-and-memory-limit-woes-solution.html

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top