Viewed   163 times

I got the following error when I run a command with php

C:xampphtdocs>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:xamppphp>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.

 Answers

2

Add C:xamppphp to your PATH environment variable.(My Computer->properties -> Advanced system setting-> Environment Variables->edit path)

Then close your command prompt and restart again.

Note: It's very important to close your command prompt and restart again otherwise changes will not be reflected.

Sunday, December 4, 2022
3

It works now. The problem was that extra slash at the end (in the PATH environment variable).

I tried with:

C:Program FilesTortoiseGitbin;C:xamppphp

but it didn't work, then with

C:Program FilesTortoiseGitbin; C:xamppphp

but it didn't work also (notice the extra space before 'C:..').

Eventually,

C:Program FilesTortoiseGitbin;C:xamppphp

did the trick.

Saturday, November 12, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :