Question

I Need to reindex and reset the indexer programmatically using external script from magento root.

How can i achieve this.Is there a Way to do this.?

I am new in magento. Please help me.

Thanks in Advance.

Était-ce utile?

La solution

please go through this link. you can use this code for re-indexing externally.

https://github.com/estvivek/External_magento_2_reindex_reset/blob/master/reindex_core.php

Autres conseils

Add below code in php file run from root:

<?php

print_r(system('php bin/magento indexer:reindex'));

You can create one file on root directory.

<?php 

print_r(exec('php bin/magento indexer:reindex >> var/log/reindexing.log 2>&1 &'));

// If you want to only reindex 'customer_grid' then you can use below line
print_r(exec('php bin/magento indexer:reindex customer_grid >> var/log/reindexing.log 2>&1 &'));

echo "Done";

You can see log in var/log/reindexing.log.

Hope this will help you!

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top