You are here: PHP hangs when exec'ing SSH « PHP « IT news, forums, messages
PHP hangs when exec'ing SSH

Posted by Ross Becker on 10/20/58 11:10

Hello,
I've beat on this for a while now, and I'm not seeming to get
anywhere. Any ideas would be appreciated.

I'm attempting to execute some things on remote servers using ssh, using
a strictly limited account created for this express purpose. I set up
passwordless key authentication from the user the web server runs as to
the limited account on the remote server. I wrote some PHP code which calls:
system("ssh user@host mycommand", $result)

If I become the web-server user and run this via php from the
command-line, everything works. The commands are executed remotely, and
the expected HTML comes to standard-out.

If I run this through apache, I can verify that the authentication
happens successfully, and the commands are run, but output to the
browser hangs. No errors, nothing. I have attempted using shell_exec,
and popen as well- both exhibit the same problems. I can run commands
other than ssh without difficulty.

This is happening on suse linux 9.1, PHP 4.3.4. Any clues as to what may
be happening?

I'm aware that there is a PECL library for calling SSH functionality,
but I really don't want to install more things and create more
dependancies for my code when this should be doable with what is already
on the system. Efficiency is not a concern in this case, either.


Cheers
Ross

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация