0

I am having an issue with running a PHP project called Phing with Cygwin. It's not a huge problem because I can make it work but I am looking for a reason or a fix so I can do it differently.

In order to have Phing work with Cygwin on my system, I must add some paths to the windows 7 environment variables through the control panel

At first I had to add 4 variables.

PHP_COMMAND = /cygdrive/e/Server/php/php.exe
PHING_HOME = E:\Server\phing
PHP_CLASSPATH = E:\Server\phing\classes
PATH : add this to the end ;E:\Server\phing\bin

What I would rather do though it add these into my .bash_profile under cygwin/home/jason/.bash_profile

Now I was able to successfully add 3 out of the 4 items to my bash_profile

PHP_COMMAND=:/cygdrive/e/Server/php/php.exe
PHP_CLASSPATH=:/cygdrive/e/Server/phing/classes
PATH=${PATH}:/cygdrive/e/Server/phing/bin

and then I had to still add PHING_HOME=:E:\Server\phing to my windows Environment Settings

Now I am not sure why though, when I try to add the PHING_HOME path to my bash_profile and then run phing inside cygwin then I get this error...

Could not open input file: /cygdrive/e/Server/phing/bin/phing.php

As long as I keep PHING_HOMEas a Environment Variable then phing runs fine.

So does anyone have any idea why this 1 variable has to be in the Environment Variables in control panel instead of inside my CYGWIN .bash_profile file?

aefxx
  • 162
  • 10
JasonDavis
  • 2,658
  • 6
  • 25
  • 32

2 Answers2

1

That is an odd one. I suggest adding

set -x

at the top of your .bash_profile. That will make bash print a listing of each following command that's being executed. By looking at what was happening right before the error message, you should be able to figure out what command is getting confused by PHING_HOME. (After the shell starts, you can turn the debugging output back off again with set +x.)

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
  • Thanks for the tip, I tried that, it is strange because this shows that `PHING_HOME=:/cygdrive/e/Server/phing` is set correctly however the phing program will only work if it is added in through the control panel still, strange – JasonDavis Dec 04 '11 at 23:05
0

Are you exporting the variables in your .profile? In bash, you can set a variable in the shell itself with

VAR=value

but that will only be available to the shell itself, not to commands you run from the shell. To make it an environment variable you have to "export" it to the environment

export VAR

You can combine these steps together if you like:

export VAR=value