note 53086 deleted from ref.ssh2 by nlopess
| From: | nlopess@php.net | Date: | Tue, 31 May 2005 17:51:43 +0000 |
| Subject: | note 53086 deleted from ref.ssh2 by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-89690@lists.php.net to get a copy of this message | ||
Note Submitter: jr at cnb dot uam dot es
----
I have made a class that allows usage of SSH from within PHP. It has several major differences with
these routines, and you may want to have a look at it.
The class I wrote (SExec) emulates 'exec' methods over SSH. It tries to mimic the major
php command execution methods/functions over SSH (proc_open, popen, etc..) and provides for
interactive sessions with remopte hosts.
The main differences are:
- it uses OpenSSH commands to do the work. This has IMHO pros and contras: it allows you to update
your SSH infrastructure without recompiling PHP, and only requires a single SSH infrastructure.
- it is really simple to use, and imitating other PHP functions, rather intuitive as well
- it is independent of PHP version. Well sort of, I have tried it on PHP4 and PHP5, but should be
portable to older versions with little work
- it is highly efficient: by multiplexing connections over a single channel (available since OpenSSH
3.8) it only requires one authentication. We routinely launch batches of thousands of SSH commands,
and the difference is amazing
- it allows you to have various simultaneous connections with various servers: this is useful for
multiplexing job launchs and providing fallback mechanisms (just make various instances)
If there is any interest on this code, just drop me a note and I'll post more details.