Stefan Stefan - 3 months ago 8
PHP Question

Windows environment variables not recognized

I'm trying to set some windows environment variables. But for some reason after saving my variable it still can't be used in cmd.

For example PHP:
php environment variable

The error I keep getting:

'D:\xampp\php\' is not recognized as an internal or external command, operable
program or batch file.


I used the Browse File... button to select the
php.exe
application just to make sure I didn't make any typos. Also I tried to change the value to
D:\xampp\php\
this didn't work either.

Restarting windows didn't help. Also typing just
D:\xampp\php\php.exe
works fine.

Does anyone have an idea what I'm doing wrong here?

Answer

If you want to use php without specifying its full path you should modify %PATH% (or create a new %PATH% user variable):

D:\xampp\php;%PATH%

%PATH% tells the operating system which directories to search when you try to run things. Make sure to log out and back in after changing this variable.

See also http://superuser.com/q/317631/312289

Comments