PUBLISHED: Feb 11, 2011 1 min read

Reindexing Magento Data via a Cron Job

Tom DiDomenico

Tom DiDomenico

Senior Vice President, Digital Strategy & Technology

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.