Page 1 of 1

executing an exe that's in another directory

Posted: Sun Apr 18, 2004 4:43 am
by slak
Hi there,

well i'm pretty noob with php, and i was trying to execute an .exe (or a .bat, I suppose it's the same) file from a php script. If the .exe and the .php files are in the same directory this code works well:

exec("program.bat ".$param1." ".$param2);

But if i try to execute /bin/program.bat like this:

exec("./bin/program.bat ".$param1." ".$param2);

it doesn't work. In my case, it's a program that creates some html files depending on the parameters given, and it doesnt produce any output at the screen.

But the files aren't created, so the file doesnt execute, what shall i do?

Thanks a lot

EDIT: Oh yeah, sorry, i've already had that in my script, but i forgot to put it in this post. :oops: It doesnt work either. :cry:

Posted: Sun Apr 18, 2004 4:52 am
by steve2004
try putting a period in front of the path
ie
exec("./bin/program.bat ".$param1." ".$param2);

I think the period tells php to look in other dir or something like that!

Posted: Sun Apr 18, 2004 5:54 am
by feyd
./ is current directory.
../ is previous (parent) directory.