How to fix one or more indexers are invalid error

2019-06-03 05:16发布

问题:

Sorry if my question was very basic or simple one. But i m trying to fix this issue from yesterday. i hope my problem also similar to this question.

i m googling since yesterday and this is what the answer i got in every forums and search result.

php bin/magento indexer:reindex

but when i tried this in cmd.exe in Windows 7 this is what error i m getting.

i m not familiar with windows command prompt & magento, used to work on Ubuntu terminal. So please again sorry if my question is very basic or stupid but please help me to solve this issue.

please check magento dashboard error below :

sorry for my bad English too

回答1:

The PHP CLI as its called ( php for the Command Line Interface ) is called php.exe It lives in c:\wamp\bin\php\php5.x.y\php.exe ( where x and y are the version numbers of php that you have installed )

If you want to create php scrips to run from the command line then great its easy and very useful.

Create yourself a batch file like this, lets call it phppath.cmd :

PATH=%PATH%;c:\wamp\bin\php\php5.x.y
php -v

Save this into one of your folders that is already on your PATH, so you can run it from anywhere.

Now from a command window, cd into your source folder and run >phppath.

Then run

php bin/magento indexer:reindex

It should work like a dream.



回答2:

just create your folder path and add "bin" directory For example :

c:\wamp\www\Magento2.0\bin>

and execute below command for reindex all indexes.

php magento indexer:reindex