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.
Best Answer
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()
inshell/abstract.php
.Easiest fix, is to just edit
.htaccess
and comment out thephp_value
directives forexecution_time
and ormemory_limit
. Alternatively you can extend the indexer by overriding theapplyPhpVariables()
method and stop it processing the.htaccess
.I made sizeable donations to my swear jar when I first discovered this 'feature'.