Jump to content

Git Problem - sh.exe": php: command not found


anevins

Recommended Posts

I've recently removed xampp and installed wamp, but now I can't use php commands.

E.g

Trying in my Git Bash window

php composer.phar install

But getting the error

sh.exe": php: command not found

 

Can I just download the command and place it in the Git \bin directory? If so, where can I download this?

 

I've been Googling for a while now and can't find how to resolve this.

Can anyone help me out please?

Link to comment
Share on other sites

Yes I am using Windows.

 

I've seen your solution in this Google result page

https://www.awbs.com/hd/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=8

 

But I don't understand what path I'm supposed to add to the beginning of the command.

 

I've tried

/d/wamp/www/dmp/php composer.phar install

Which is the directory of my composer.phar file, but the command not found error remains.

 

I've also tried

/d/Git/bin/php composer.phar install

But still no.

 

I appreciate the help by the way.

Link to comment
Share on other sites

Okay I've looked at that URL for the other kind of path and found this under my Path environment variable

C:\Windows\system32

C:\Windows

C:\Windows\System32\Wbem

C:\Windows\System32\WindowsPowerShell\v1.0\

c:\Program Files\WIDCOMM\Bluetooth Software\

c:\Program Files\WIDCOMM\Bluetooth Software\syswow64

C:\Program Files\Dell\Dell Wireless WLAN Card

C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\

D:\QTSystem\

 

I've gone through each one and appended php composer.phar install on the end, however I'm still receiving command not found.

 

I thought you could mean that kind of path applied to my tryouts in my second post, so I tried

$ d:\wamp\www\dmp\php composer.phar install
sh.exe": d:wampwwwdmpphp: command not found

andrew@ANDREW-PC /d/wamp/www/dmp (master)
$ d:\Git\bin\php composer.phar install
sh.exe": d:Gitbinphp: command not found

 

I am puzzled as to why I still cannot call this command.

Link to comment
Share on other sites

Ok, I think you're a little confused on what the problem is.  The problem doesn't lie with composer.phar but rather that php isn't in the environment path.  Using php in a shell/command is the prompt to use PHP to execute the forthcoming commands.  You need to find the path to the php executable and put THAT into your env paths.

Link to comment
Share on other sites

So from what I understand with your explanation, the actual PHP needed to execute the command is not there.

Using this tutorial from http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopath

I found what I think was PHP files in my wamp folder, under D:\wamp\bin\php\php5.3.13 and put that path into the environment variable section.

 

E.g

D:\wamp\bin\php\php5.3.13\ext; on the end of the other values.

 

Am I still missing the point here?

Link to comment
Share on other sites

As you can tell, I'm quite out of my depth.

 

I started fiddling around with the directory of the PHP and this time used forward slashes instead of back.

This was the result;

 

andrew@ANDREW-PC /d/wamp/www/dmp (master)
$ D:/wamp/bin/php/php5.3.13/php composer.phar install
Composer could not find a composer.json file in D:\wamp\www\dmp
To initialize a project, please create a composer.json file as described in the
http://getcomposer.org/ "Getting Started" section

 

Is this topic solved? I can't tell.

Link to comment
Share on other sites

Yes, you've found the proper location of the "php.exe" file, and as such you can add that to the environment path. It'll be active the next time you start a terminal session. I recommend using backslashes though, seeing as you're on Windows, even if forward slashes work (in some cases).

 

For the current error message: The solution is listed in the message itself, I recommend following up on its instructions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.