Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

how to run linux command through browser using php program

Question posted by: thirusvga (Newbie) on April 9th, 2008 07:00 AM
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='ooffice -invisible "macro:///Standard.Module4.Main()"';
print system($command);
echo"successfully 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...
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
docdiesel's Avatar
docdiesel
Moderator
245 Posts
April 22nd, 2008
07:40 AM
#2

Re: how to run linux command through browser using php program
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: ( text )
  1. $command='/full/path/to/ooffice -invisible "macro:///Standard.Module4.Main()"';
If this doesn't work either, run a "set" command :
Code: ( text )
  1. $command='set >/tmp/apache.env.txt';
and compare the output this is giving when run from shell and from apache, respectively.

Regards,

Bernd

Reply
Reply
Not the answer you were looking for? Post your question . . .
170,099 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top Apache Forum Contributors