I am getting error in command line in window. "command is not recognized as an internal and external command. operable program or batch file". this error occurs when i run any command.
3 Answers
You can run php pages using php.exe create some php file with php code and in the cmd write:
[PATH to php.ext]\php.exe [path_to_file]\file.php
you can also add path of php.exe in system PATH environment variable so you can use PHP as command from any directory in windows.
Example Case:
- My XAMPP is installed on D:\php\ and php.exe resides in D:\php\php and Magento folder is here D:\php\htdocs\MG\m212 ( http://localhost/MG/m212/)
- Go on to D drive.
- D:\php\php>php D:\php\htdocs\MG\m212\bin\magento indexer:reindex
On XAMPP:
Installed Xampp_root/php>php 'Path_to_project'
On WAMPP: 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 )
You have to go to the php folder where xampp is installed and then run the commands by passing the full path to
magento\bin
For example, I have php folder under F: drive. So, I will first go to F:/xampp/php and then will run the commands. e.g.
php F:\xampp\htdocs\magento-2\bin\magento setup:upgrade
Open CLI from Xampp and go inside project.
Assumed your project and xampp on D:
Drive:
Navigate inside project like: cd D:\xampp\htdocs\Magento2
CLI Path will be like: D:\xampp\htdocs\Magento2
php bin\magento setup:upgrade