Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell Git I'm upgrading php?

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.

like image 669
Miles M. Avatar asked Jun 28 '12 16:06

Miles M.


3 Answers

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.

like image 156
Braden Avatar answered Nov 13 '22 23:11

Braden


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.

like image 45
richo Avatar answered Nov 14 '22 00:11

richo


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.

like image 3
Danny Thompson Avatar answered Nov 13 '22 22:11

Danny Thompson