Reindex magento data via SSH

The fastest way to re-index magento data is manually via SSH.
When you re-index from admin section, sometime the re-indexing process get stuck due to expire session or crss maximum execution time or any other reason. The best and fastest way to re-indexing the Magento data is via SSH

In this article i will guide you how to re-index via SSH:

  • Login to your SSH account. if you didn’t have please contact with the server guy, they will provide you.
  • Go to the server directory where magento get installed
  • Got to the “shell” directory. cd your_magento_directory/shell
  • now you can use below code to re-index magento data:
    php -f indexer.php — -reindex catalog_product_attribute
    php -f indexer.php — -reindex catalog_product_price
    php -f indexer.php — -reindex catalog_url
    php -f indexer.php — -reindex catalog_product_flat
    php -f indexer.php — -reindex catalog_category_flat
    php -f indexer.php — -reindex catalog_category_product
    php -f indexer.php — -reindex catalogsearch_fulltext
    php -f indexer.php — -reindex cataloginventory_stock
  • if you want to re-index all then use:
    php -f indexer.php reindexall