Question

I've just upgraded PHP to the latest version. When I get back to Git, to my command shell, if I execute any PHP function, then I get this error :

sh.exe": php: command not found

I know I have to tell git bash where my new PHP path is, but I don't know how to do so and I can't find anything on Google about that.

EDIT :

I made a confusion you're right : I meant Git BASH by git. Thanks :)

SO here is the function I tried to call when I was dealing with symfony in the root foler of my app :

php app/console dump-sql

then Git BASH sent me the error above.

Was it helpful?

Solution

If you are windows, then following up on halfer's comment, it is required that you add the new /bin/ directory of the php folder to your PATH.

To do this: 1. Open start menu
2. Right click my computer->properties
3. Click advanced tab -> Environment variables
4. Scroll down in the second listbox for a entry called PATH
5. add this to the end ;C:/%PHP_LOCATION%/bin
where %PHP_LOCATION% is the place that you installed PHP to.

OTHER TIPS

I think you have git and bash confused.

Git is a program that would be running under bash, and isn't directly related to git unless you've gone out of your way to entangle them.

Most likely, the incantation you need is

export PATH=/path/where/php/is:$PATH

And then everything will be working. Note that needs to be the path to the directory, not the binary.

the $PATH at the end is to make sure that you don't clobber your old path.

I had the same error. I found that I needed the environment variable path in this format:

/c/wamp/bin/php/php5.3.13 (instead of C:\wamp\bin\php\php5.3.13)

Using Windows 7 & Git 1.7.10.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top