how to run linux command through browser using php program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thirusvga
    New Member
    • Feb 2008
    • 9

    how to run linux command through browser using php program

    Hi...boss..
    I want to run a linux command using php through browser...php program is stored in /var/www/html/t.php
    that program is
    <?php
    $command='ooffi ce -invisible "macro:///Standard.Module 4.Main()"';
    print system($command );
    echo"successful ly converted";
    ?>
    the above program is run in terminal....
    [root@localhost html] php t.php
    successfully run
    But doesnot run in browzer...
    why apache server doesnot support this program..
    please tell me...
  • docdiesel
    Recognized Expert Contributor
    • Aug 2007
    • 297

    #2
    Hi,

    I guess the PATH variable isn't the same for your shell and for apache, or some other env. variable is missing. Try to run the ooffice command with full path:

    Code:
    $command='/full/path/to/ooffice -invisible "macro:///Standard.Module4.Main()"';
    If this doesn't work either, run a "set" command :
    Code:
    $command='set >/tmp/apache.env.txt';
    and compare the output this is giving when run from shell and from apache, respectively.

    Regards,

    Bernd

    Comment

    Working...