Question in phpseclib and exec() ?

Discussion in 'PHP' started by subash057, Aug 31, 2010.

  1. #1
    Hello,

    I am trying to connect a unix server using ssh (phpseclib) and running an external program like 'C' program or a fortran program. I am using exec() to run .out. My code looks this way

    echo $ssh->exec('./a.out');
    Code (markup):
    a.out is a executable for program to add two numbers and the inputs are hardcoded within the 'C' program.

    This piece of code works perfectly when the inputs are hardcoded in the 'C' program. But when I try to pass the arguments to exec(), the php script becomes unresponsive. After modification to accept inuts for .out, my code looks this way,

    echo $ssh->exec("./a.out");
    echo $ssh->exec("10 20");
    Code (markup):
    where a.out is an executable for a simple program to add two numbers and 10 and 20 are inputs to a.out. I did modify the code as below and tried few options

    $ssh->exec("./a.out '10' '20'");
    $ssh->exec("./a.out ; '10 20'"); 
    Code (markup):
    but none of them worked. All the above php scripts became unresponsive.
    How do I pass inputs to a.out in next line using exec()?
    Any inputs on this are greatly appreciated.

    Thanks in Advance..
     
    subash057, Aug 31, 2010 IP