Magento reindex desde la línea de comandos, que aún tiene un error de tiempo de espera
-
16-10-2019 - |
Pregunta
Estoy tratando de reintegrar mi tabla Catáloga_url_rewrite (sitio web de Magento) a través de la línea de comando usando el comando "PhP indexer.php --Rindex Catalog_url" in /shell. Obtuve el siguiente error:
PHP Fatal error: Maximum execution time of 60 seconds exceeded in /var/www/domain.com/lib/Zend/Db/Statement.php on line 141
El archivo y la línea en el error varían.
He verificado dos veces para confirmar que PHP en la línea de comando está utilizando la versión PHP -CLI (usando "PHP -I") y que no hay límites en su configuración que deberían producir tal error.
También he mirado a su alrededor para ver si algún archivo Magento está configurando el "set_time_limit" manualmente, pero no pude encontrar nada que apunte de esa manera. No puedo encontrar los 60 segundos max_execution_time en ninguna parte.
¿Alguna idea de lo que está pasando?
Editar:
Hasta ahora he intentado:
- Ejecutando "Php -d max_execution_time = 0 indexer.php --reindex catalog_url"
- Configurar "set_time_limit (9000);" en indexer.php directamente.
- Ejecutar el archivo de configuración "Php -i" para ver "(php.ini) ruta =>/etc/php5/cli" & "archivo de configuración cargado => /etc/php5/cli/php.ini"
- Configurar max_execution_time en Php.ini de FPM en 61 solo para ver si lo estaba usando por accidente.
- Se aseguró de que "set_time_limit (60)" no esté codificado en ningún lugar del marco Magento.
Solución
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'.
Otros consejos
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