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
.



Relevant Pages

  • Re: PHP web interface for shell script or command
    ... read items off the file and execute the intended script running as the ... I was using php from the command ... You need to play around with sockets, google for php telnet sockets or ...
    (comp.lang.php)
  • Re: Exec() function not doing as I want (OSX)
    ... I have a little problem with one function within my cd-management script. ... execute with exec: ... The executable is in the same directory as the php script is in. ... exec() on it to see if the execis working right, ...
    (comp.lang.php)
  • Re: Exec() function not doing as I want (OSX)
    ... I have a little problem with one function within my cd-management script. ... execute with exec: ... The executable is in the same directory as the php script is in. ... exec() on it to see if the execis working right, ...
    (comp.lang.php)
  • Re: Call a local function or a separate PHP file?
    ... > script can call instead a local function to execute the job? ... No. PHP is an interpretor that executes as the web server (usually ... To run more script, ... However, you're obviously new to server-side scripting, and you haven't ...
    (comp.lang.php)
  • Re: Exec() function not doing as I want (OSX)
    ... Bill H wrote: ... I have a little problem with one function within my cd-management script. ... execute with exec: ... The executable is in the same directory as the php script is in. ...
    (comp.lang.php)