Using PHP ssh2 lib to create simple SSH client with ANSI support
December 25th, 2009
6 comments
If you’re a real geek, you might want to make an ssh client… using php, well, this is something that no one will probably ever need to do… but if you’re reading this, maybe it happens so that you need it :)
So, to start with, there is a php extension called libssh2, and it’s really tricky to install it on some server configurations. I’m not going to discuss that part here because it’s purely server administration issue. I will just get to the coding part.
What we want to do here is to create php script that would run from console, will connect to remote ssh server, execute commands, and display output just like every ssh client does. The first problem is – libssh2 documentation on php site really sucks.

