Re: Path getting messed up - cannot find a file



On 2008-02-23, Otis <otie_nospam@xxxxxxx> wrote:
If I run the following code:

exec ("swetest -edir$sweph -b$utdatenow -ut$utnow -p012 -eswe -flsj -g,
-head", $out);

all is well - PHP finds the program swetest and makes the calculations.


But if I then insert this beforehand:

$NetGeoHTML = file_get_contents($NetGeoURL, 99000);

exec ("swetest -edir$sweph -b$utdatenow -ut$utnow -p012 -eswe -flsj -g,
-head", $out);

I get no output because apparently PHP does not know where to find the
program called swetest. Why does "file_get_contents" mess up my "path" and
how do I get this to work?

Thank you.

FWIW, generally, it's a good idea to specify the full path to the program.

for example:
exec ("/usr/local/bin/swetest -edir$sweph -b$utdateno...............

ken

.