Magento 1.x – How to Reindex Using Command Line

command linemagento-1.9reindex

How can I reindex magento using by command line.
Kindly provide steps for the same.

Best Answer

step 1 : cd [MAGENTO_ROOT]/shell/

You should replace [MAGENTO_ROOT] with your own absolute path to Magento root folder. For example /home/Thief/public_html/ Then list all files to see what we have here. Just enter simple command:

step 2 : ls -l

If you can find something like ‘indexer.php‘, that’s what we need and we can go on. To see the status of all indexes, you can execute the command

php indexer.php --status

step 3 : php indexer.php --reindex catalog_product_price 

Here catalog_product_price is the index type that you want to rebuild. You can use next arguments for different types of indexes:

catalog_product_attribute Product Attributes
catalog_product_price Product Prices
catalog_url Catalog Url Rewrites
catalog_product_flat Product Flat Data
catalog_category_flat Category Flat Data
catalog_category_product Category Products
catalogsearch_fulltext Catalog Search Index
cataloginventory_stock Stock status

For all reindexall : php indexer.php --reindexall

Background reindex process Sometimes you may want to run this process in background so you can turn off your computer or just have a couple of beers. In this case, you can use a command line tool, called ‘nohup’. It allows you to run almost any CLI command in background independently from your current session. If you want to reindex something in background, your command should look like this:

nohup php indexer.php --reindex catalog_product_price &

For more information refer this link

Related Topic