I got the following error when I run a command with php
C:\xampp\htdocs>php
'php' is not recognized as an internal or external command,
operable program or batch file.
I don't get any error when I run the command with php
in following path:
C:\xampp\php>php //do not got error here
Why I get this error?
'php' is not recognized as an internal or external command, operable program or batch file.
Is your path correctly configured?
In Windows, you can do that as described here:
http://www.computerhope.com/issues/ch000549.htm
I also got the following error when I run a command with
PHP
, I did the solution like that:C:\xampp\php
to your PATH Environment Variable.Very important note: restart command prompt
You need to Go to My Computer->properties -> Advanced system setting
Now click on Environment Variables
Add ;C:\xampp\php in path variable value
Now restart command prompt DONE!
Note: Make sure you run CMD via run as administrator
You just need to a add the path of your
PHP
file. In case you are usingwamp
or have not installed it on the C drive.Add
C:\xampp\php
to yourPATH
Environment Variable.Then Close your Command Prompt And Restart Again.
It's very important because if you didn't restart you command prompt then changes will not be reflected.
Set
"C:\xampp\php"
in your PATH Environment Variable. Then restart CMD prompt.