I am trying to print out the output from linux command in php. from the command line i am able to view the output, but when i run it from a browser there is no out put. anyone who can assist?

$ex1="ssh myname@server tail -10 /mnt/data/stat/status-rx.log";
echo "<pre>$output1</pre>";

any help will be appreciated.

What happens if you try something simpler like:

$output = `ls`;
echo "<pre>$output</pre>";

Still no output ? Is safe-mode enabled, or shell_exec disabled ?

when i try that its able to output the result of the command. but when trying to ssh i dont get any output.

The problem is not in the function, but in the output of ssh, so using exec() would not fix the problem.

after rerouting the output from stderr i get this message

Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).

that's a problem from ssh. Apparantly you're not allowed to connect. Remember that if run it from the commandline, then you're using it with your user rights. If you use it through php, then different rights apply. Am not familiar enough to provide a solution for this.

so what do u suggest i do, i give the user httpd rights?

I think it is the other way around, that you should give the httpd rights to ssh. But as I said, am not too familiar with this. I think you can better ask this in the linux forum.

The best / safest way is to use the suphp mod.

I won't go into details of why its a bad idea to lower the user permissions for ssh or raise the user permissions of your web server.