exec()

I have a problem with the exec function. When I use this code:

$res=exec("XValue 100 200",$X_Number,$r);

echo "$X_Number[0]" //The first item that i echoed in my program code

echo "$r" //The returned value from my program

it doesn't seem to work. The program (XValue) returns a number. it works on my windows system, but it doesn't work on my Red Hat Linux system. Does anybody have an idea of what's going wrong?

Comments

  • try adding the newline character at the end of your echo statement.
    example:
    echo $X_Number[0] . "
    ";
    or
    printf("X_Number[0] = %d
    ", $X_Number[0]);

    hope this helps...

    : I have a problem with the exec function. When I use this code:
    :
    : $res=exec("XValue 100 200",$X_Number,$r);
    :
    : echo "$X_Number[0]" //The first item that i echoed in my program code
    :
    : echo "$r" //The returned value from my program
    :
    : it doesn't seem to work. The program (XValue) returns a number. it works on my windows system, but it doesn't work on my Red Hat Linux system. Does anybody have an idea of what's going wrong?
    :

  • : I have a problem with the exec function. When I use this code:
    :
    : $res=exec("XValue 100 200",$X_Number,$r);
    :
    : echo "$X_Number[0]" //The first item that i echoed in my program code
    :
    : echo "$r" //The returned value from my program
    :
    : it doesn't seem to work. The program (XValue) returns a number. it works on my windows system, but it doesn't work on my Red Hat Linux system. Does anybody have an idea of what's going wrong?
    :

    If you doesn't get any output at all, or if you get some strange errors, is proberly a problem with the rights.
    Does php have the rights to execute commands on the linux system, and is the execute flag on the external program set?
    I'm pretty sure php doesn't have the rights to execute the application :)
    An other solution could be to give the full path to your external program.

    aCe
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories