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.

Share:
38,044

Related videos on Youtube

Zubzob
Author by

Zubzob

Updated on September 18, 2022

Comments

  • Zubzob
    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?

    xampp php folder screenshot

    • Admin
      Admin about 11 years
      Check if php.exe is in `C:\xampp\php` or some subfolder there
    • Admin
      Admin about 11 years
      Pretty sure it's there. Added a screenshot.
    • Michel Feldheim
      Michel Feldheim about 11 years
      Reopen your cmd window after you have added the path, then the change will have an effect
    • The Alpha
      The Alpha about 11 years
      I think you need to restart the computer to take effect the changes you have made in path.
    • Admin
      Admin about 11 years
      I've restarted my PC multiple times after modifying the variable system with no luck.
    • Robert
      Robert about 11 years
      restart will be needed or at last : nerdydork.com/update-windows-path-without-rebooting.html
    • Robert
      Robert about 11 years
      have you tried to use "C:\xampp\php" instead of "C:\xampp\php" not sure if it makes anz difference under windows
    • Wrikken
      Wrikken about 11 years
      Ugh, Windows was a long time ago here... perhaps the ending slash is frowned upon?
    • paddy
      paddy about 11 years
      Try 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 run php 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
      Karan about 11 years
      Ending 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
      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
      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
    Enke over 10 years
    Still doesn't work for me :( Any other tips?
  • PHP Mentor
    PHP Mentor over 8 years
    @Enke try adding full path C:\xampp\php\php.exe, This could be the problem/