Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    30

    Unanswered: can anyone gives me idea of how to code this?

    i'm just trying to make php execute some unix commands or shell script(let's say ssh & ls)

    I have a button "Execute" and a <textarea>

    When i press the button, A script.sh will be executed and result wil be displayed on <textarea>

    I m still in a fix of where to get started..

  2. #2
    Join Date
    Sep 2004
    Posts
    46
    ex:
    // Outputs all the result of shellcommand "ls", and returns
    // the last output line into $last_line. Stores the return value
    // of the shell command in $retval.
    $last_line = system('ls', $retval);

  3. #3
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    To execute a sheel command and to get the value from that command is
    <?php
    $output = `ls -al`;
    echo "<textarea cols=80 rows=30><pre>$output</pre></textarea>";
    ?>
    OR
    <?php
    $str=shell_exec("ls -l");
    echo "<textarea cols=80 rows=30>$str</textarea>";
    ?>
    Both the method works. Now it's up to you to make use of it.

    Regards
    Rajesh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •