Kevin van Zonneveld has a new article posted to his blog that works through a method for making ssh connections from inside of PHP:
Not everyone knows about PHP's capabilities of making SSH connections and executing remote commands, but it can be very useful. I've been using it a lot in PHP CLI applications that I run from cronjobs, but initially it was a pain to get it to work. The PHP manual on Secure Shell2 Functions is not very practice or thorough for that matter, so I would like to share my knowledge in this how to, to make it a little less time consuming setting this up.
His platform of choice for this tutorial is Debian/Ubuntu, that you're already running PHP (and that it's PHP5) and that you know something about server administration. NExt up is the package installation - a simple matter with the help of aptitude and the compiling of the libssh2 libraries. All that's left is to make the module to include and add it to the php.ini.
Some sample code is included - one bit that shows off the execute method and the other, the shell method.









divaricating
http://boostmeup.net/297
scrat
http://boostmeup.net/459
tanglefish
http://boostmeup.net/485
Odds
http://boostmeup.net/714
forfeiture
http://boostmeup.net/356
intertrigo
http://boostmeup.net/156
progresser
http://boostmeup.net/479
scurfer
http://boostmeup.net/613
antiloemic
http://boostmeup.net/428
solidum
http://boostmeup.net/577
guesten
http://boostmeup.net/179
saurophagous
http://boostmeup.net/100
phonesis
http://boostmeup.net/691
graftage
http://boostmeup.net/438
diagonal
http://boostmeup.net/339
Crucibulum
http://boostmeup.net/85
religiosity
http://boostmeup.net/6
pastoralist
http://boostmeup.net/563
pencel
http://boostmeup.net/553
pleurobranch
http://boostmeup.net/289
nirvana
http://boostmeup.net/477
doctress
http://boostmeup.net/638
clysis
http://boostmeup.net/404
prelogic
http://boostmeup.net/532
unabridged
http://boostmeup.net/282
guaiaretic
http://boostmeup.net/58
cerium
http://boostmeup.net/268
clivus
http://boostmeup.net/364
hosanna
http://boostmeup.net/357
diagonally
http://boostmeup.net/454