Reindexing Magento Data via a Cron Job

I like to have all Magento data re-indexed every night via a cron job. That way I KNOW the indexes are up to date.

To create the cron job, add the following to your cron file to reindex every day at 4am

0 4 * * * php -f /shell/indexer.php reindexall

Note: If you get an error telling you you’re out of memory similar to:

PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 7680 bytes) in …/app/code/core/Mage/Index/Model/Indexer.php on line 163

Try commenting out php_value memory_limit and php_value max_execution_time in your .htaccess file.

TAGS: CronMagentoMemoryReindex

3 Responses to “Reindexing Magento Data via a Cron Job”

  1. How is changing the .htaccess file going to affect the configuration of PHP?

    The .htaccess is read by Apache which isn’t involved in running PHP directly into the interpreter.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>