Howdy, Stranger!

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

Categories

exec()

DuivelkeDuivelke Member Posts: 7
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

  • Craz1Craz1 Member Posts: 4
    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?
    :

  • nyhjemnyhjem Member Posts: 3
    : 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
  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    _ // http://forcoder.org // free ebooks and video tutorials about \ PHP, Go, Scratch, Visual Basic .NET, Objective-C, PL/SQL, JavaScript, Swift, Python, MATLAB, Visual Basic, Ruby, C++, Assembly, R, Java, Perl, C, C#, Delphi Lisp, Bash, Crystal, Ada, Logo, COBOL, Rust, VBScript, Scheme, Apex, ABAP, Erlang, Alice, Kotlin, Hack, LabVIEW, Scala, F#, Prolog, Awk, SAS, D, ML, Julia, Fortran, Dart, FoxPro, Clojure, Lua, Transact-SQL \ __________

Sign In or Register to comment.