Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting PHP variable path for Cygwin

I am having a lot of difficulty routing PHP to cygwin.

My goal is simply to run the following PHP test command successfully:

php -v

I'm currently getting the following error: -bash: php: command not found

This is what I tried in the .bash_profile document:

PATH = $PATH:/xampp/php
export PATH

I am using xampp and my php.exe is in the following path C:/xampp/php/php.exe, also I noticed there isn't a bin directory in my php directory. There is a bin directory in C:/xampp/apache perhaps this is the one I should link to? I tried this as well with no success.

like image 431
AnchovyLegend Avatar asked Jan 18 '14 22:01

AnchovyLegend


2 Answers

In Cygwin you windows C drive is mounted to /cygdrive/c/ so if you wanted to add C:/xampp/php/ to your path, then you should add the following to your .bashrc:

export PATH=$PATH:/cygdrive/c/xampp/php
like image 94
flungo Avatar answered Nov 11 '22 15:11

flungo


What @flungo wrote was absolutely correct: I have to add this line to C:\cygwin64\etc\bash.bashrc in order for each new cygwin terminal to have the correct $PATH

export PATH=$PATH:/cygdrive/c/xampp/php
like image 43
brandelizer Avatar answered Nov 11 '22 16:11

brandelizer