Fastest way to reindex Magento via SSH

Table of Contents

Magento store uses an indexing mechanism to calculate product prices. Therefore, any change in product price or details need quick re-indexing.

One of the fastest way to reindex Magento is via SSH. However, Magento store owners often get errors during reindexing process.

That’s why, we often handle requests for Magento reindexing as part of our Server Management Services.

Today, we’ll see how our Magento Engineers use Magento reindex SSH option and fix errors with it.

 

 

The need for Magento index

First, let’s check on the need for index management in Magento.

Magento maintains a complex way to store the details about the products in the store. This involves storing catalog data, prices, users, stores, and so on. Again, this data will be kept in different database tables. As a result, it often end up in heavy database queries to retrieve simple results. And, this would drop Magento performance as such.

There comes the role of Magento Index tables. Here, Magento perform query and store all the data into a single table structure. Thus Magento just need to query the single Index table.

However, for indexing to work properly, Index table need regular updates. That’s why, our Magento Experts always recommend indexing after every modification in database.

 

How to do re-indexing using SSH

Magento allows to reindex from the Admin panel. But, it can be time consuming. And, the fastest way to reindex Magento is via SSH.

However, the exact steps to re-index varies with Magento versions. Let’s now check on how our Support Engineers do Magento re-indexing.

 

In Magento 1

Magento 1 comes with an indexing script indexer.php. It is available in the Magento installation directory under the shell folder. This shell script helps to reindex Magento using SSH or CLI.

To execute the script, we connect to the server as the user via SSH. Then, we change directory to Magento folder and execute the command:

php shell/indexer.php reindexall

This will reindex data by all indexers without any timeouts.

Similarly, to reindex a single index, we run the command :

php shell/indexer.php --reindex [Index Option Code]

However, in all cases, the user need SSH access on the server.

 

Similarly, it is possible to reindex from panel in Magento 1. Here, we connect to Magento Admin panel first. Then, we go to System > Index Management, check all the indexes to reindex and then submit the request.

 

In Magento 2

Magento 2 also support re-indexing via SSH. To make a reindex in Magento 2, our Dedicated Engineers connect to the server via SSH and we run the command for reindex as:

php bin/magento indexer:reindex

For customers connecting from a Windows computer, we recommend them to use PuTTY or another terminal application to run the CLI commands.

Again, our Support Engineers always check the status of the indexers after reindexing using the command:

php bin/magento indexer:status

 

Frequent Magento reindex errors

From our expertise in managing Magento application, we often see errors when trying to reindex Magento via SSH. Let’s check the top errors and how we solve it.

 

1. Incorrect path to the reindex script

A common reason for reindexing error will be the incorrect path to the reindex script. Recent;y, one of our customer reported error with his Magento website. He was running the following command to reindex his Magento website.

php indexer.php --reindex catalog_product_attribute

But nothing happened and resulted in the error “could not find indexer.php“.

On a detailed check, we found that customer was trying to execute the indexer.php from the wrong location. This caused the problem here. We made customer execute the script from Magento installation/shell directory and that fixed the error.

 

2. Index Products Stuck on Processing

Similarly, Magento store owners also can have problems with stuck reindexing process. Here, in Magento, Index Products/Categories will be stuck while trying to rebuild. The admin panel shows it as “Processing….“. Then it spins forever and finally results in crashing the admin panel.

This happens as the reindexing process times out and does not complete.

In such cases, we take a a backup of the Magento website first. Then our Dedicated Engineers remove the files from the Directory /var/locks/

 

3. PHP limit restrictions

We often see PHP limit restrictions creating problems with Magento reindexing too. And, it would result in error messages like

Fatal error: Allowed memory size of 34789864 bytes exhausted (tried to allocate 128 bytes)

This happens as most hosting servers limit the amount of resources an individual account can use. The applies to memory limit as well as other parameters.

In such cases, we increase memory size allotted to the account by modifying the php.ini configuration file of the domain. With new limits, the Magento indexing process work successfully.

 

[Do you need to reindex Magento websites? Our experts can help you.]

 

Conclusion

Magento websites can optimize performance using Magento reindex SSH option. Today, we saw the re-indexing process in Magento store and how our Support Engineers fix related errors.

Leave a Comment

Your email address will not be published. Required fields are marked *

Social Share

Facebook
Twitter
LinkedIn
Telegram

Cheapest Web Hosting

Fasters Web Hosting Promo
Scroll to Top

Launch your Website at RS599

Create a professional website yourself with our domain hosting combo. Get Extra benefits at this Year end Sale with 10% OFF and Enjoy Amazing Deels on Shared Hosting!

Starting at Only RS599/Year

Year End Sale

Hours
Minutes
Seconds

Use Code STARTBIZ at Checkout.

Create an earning opportunity with A Web Hosting Business

Become reseller and start reselling domains, web hosting, ssl certificates and More.

45% OFF

Starting at RS399/Month

Hours
Minutes
Seconds

Use coupon: at the checkout.