How to re-index from PHP command line using SSH

As your Magento store grows in size with more products, orders and customers, you may experience difficulty while re-indexing data through Magento's web admin interface. Fear not - it is possible, and advisable, to run the reindexing through command line using SSH.

  1. Log in to your server or hosting account via SSH, ensuring you use the same credentials as the Magento installation (i.e. never log in with root)
  2. Navigate to /public_html/shell/ folder
  3. Check the status of the indexes to see what needs reindexing
    php indexer.php --status
  4. To reindex all
    php indexer.php --reindexall
  5. Or, find the key names of each index and reindex only the items requiring a reindex
    php indexer.php --info
  6. Running the above will give you a list as follows:
    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
    tag_summary
    Tag Aggregation Data
  7. Now choose the key names that require reindexing and run, seperating with a comma if more than one
    php indexer.php --reindex key_name_here
  8. As an example, if we need to reindex catalog_product_flat and catalog_category_product we would choose
    php indexer.php --reindex catalog_product_flat,catalog_category_product
  9. Now we wait until completion - you'll get a message after it's done telling you how long it took to complete
  • magento, magento 1, index, reindex, ssh, reindex.php, reindex slow, reindex stuck, reindex processing
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Exception: Notice: Use of undefined constant ICONV_IMPL

Exception: Notice: Use of undefined constant ICONV_IMPLAre you experiencing this error when...

How to upgrade Magento 1 using SSH CLI

This is an easy and quick upgrade guide for updating Magento 1.7, 1.8 and 1.9 to Magento 1.9.x....

Efficient Magento 1 cron on CloudLinux systems

It's no secret that CloudLinux, with its CageFS and PHP selectors, cause problems running the...

How to Install RabbitMQ Server on CentOS 7

RabbitMQ is an open-source message broker, which can be used to greatly enhance the speed of...