By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,263 Members | 2,640 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,263 IT Pros & Developers. It's quick & easy.

how to run linux command through browser using php program

P: 9
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...
Apr 9 '08 #1
Share this Question
Share on Google+
1 Reply


docdiesel
Expert 100+
P: 297
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:

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

Regards,

Bernd
Apr 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.