Re: Exec() function not doing as I want (OSX)



On Sep 19, 3:35 pm, Maarten <b...@xxxxxxxx> wrote:
Howdy,

Recently I switched from a Windows PC to Mac OS-X 10.5 (php v5.2.6) and
I have a little problem with one function within my cd-management script.

For extracting a bit of info from my cd's I have an executable which I
execute with exec():

     $discOutput = exec('./discid /dev/rdisk2');

The executable is in the same directory as the php script is in. When I
run the same line from Terminal within that same directory it gives me
the output I want, php doesn't give me any ouput at all.

Asking exec() for output on a basic function like 'ls' does return a
value, so the function is active. I guess somehow I am not pointing to
the discid executable correctly, but I don't see what is wrong.

Can someone tell me what I am doing wrong?

Thanks in advance, Maarten

I had a similar issue when runnning a script in linux under apache. It
took awhile for me to figure out I had to "cd" to the directory I
wanted to work in and use an absolute path to the exe that is being
executed. You may want to try something like this:

$discOutput = exec('cd /dev/rdisk2;[fullpathto discid]/discid');

Bill H
.