php is not recognized as an internal or external command (windows 7)
38,044
It works now. The problem was that extra slash at the end (in the PATH environment variable).
I tried with:
C:\Program Files\TortoiseGit\bin;C:\xampp\php\
but it didn't work, then with
C:\Program Files\TortoiseGit\bin; C:\xampp\php
but it didn't work also (notice the extra space before 'C:..').
Eventually,
C:\Program Files\TortoiseGit\bin;C:\xampp\php
did the trick.
Related videos on Youtube
Author by
Zubzob
Updated on September 18, 2022Comments
-
Zubzob over 1 year
I added php to the PATH environment var. Showing here my last three entries in the path input:
C:\Program Files\TortoiseSVN\bin;C:\Program Files\TortoiseGit\bin;C:\xampp\php\
Somehow when I run
php -v
in the cmd I still get the not recognized as an internal or external command error.Any ideas on how should I fix this?
-
Admin about 11 yearsCheck if php.exe is in `C:\xampp\php` or some subfolder there
-
Admin about 11 yearsPretty sure it's there. Added a screenshot.
-
Michel Feldheim about 11 yearsReopen your cmd window after you have added the path, then the change will have an effect
-
The Alpha about 11 yearsI think you need to restart the computer to take effect the changes you have made in path.
-
Admin about 11 yearsI've restarted my PC multiple times after modifying the variable system with no luck.
-
Robert about 11 yearsrestart will be needed or at last : nerdydork.com/update-windows-path-without-rebooting.html
-
Robert about 11 yearshave you tried to use "C:\xampp\php" instead of "C:\xampp\php" not sure if it makes anz difference under windows
-
Wrikken about 11 yearsUgh, Windows was a long time ago here... perhaps the ending slash is frowned upon?
-
paddy about 11 yearsTry replacing the path with only the
xampp
directory. You can do this in the command shell so there's no need to trash your computer's environment or restart. I assume you are trying to runphp
from the shell rather than the windows 'run' dialog. This might seem like a weird thing to ask, but does it work if you use an explict path:c:\xampp\php\php.exe -v
? -
Karan about 11 yearsEnding slash is not a problem with Win7 at least (by default PATH contains
C:\Windows\System32\WindowsPowerShell\v1.0\
), and a restart is most definitely not required! Only the command prompt window needs to be closed and reopened for the changes to take effect. -
Zubzob about 11 years@paddy: yes, that displays the php install info. But isn't the environment variable's purpose to allow me using 'php' command anywhere in cmd ?
-
paddy about 11 years@zubzob You only answered the least interesting part of my comment. Can you comment on the rest? We're trying to work out what's going on because there's not enough information in your question, or even your comments. My suggestions are not solutions - they are an attempt to isolate the issue. You need to state whether any assumptions we have made are true or false.
-
-
Enke over 10 yearsStill doesn't work for me :( Any other tips?
-
PHP Mentor over 8 years@Enke try adding full path
C:\xampp\php\php.exe
, This could be the problem/