if you're trying to connect to an ssh server in an environment where the ssh2 extension cannot be installed this pure-php implementation may be helpful:
For windows users only:
The PECL ssh2 extension is not able to use (at least) the pubkey authentication correctly, as well as it will crash at the point where the connection is closed because of the wrong functions being used under windows.
Thanks to some patches and comments from other users I was able to compile this extension and you can download it from:
This works (at least) with PHP 5.2.8. It is linked against libSSH2 v1.0 and OpenSSL v0.9.8i.
if you are trying to build this PECL extension because your distro does not already provide it.... then you need to apply a patch or else it won't "make". The problem is that libssh2 has changed the name and value of a conditional compile flag. See this bug for the fix.
P.S. if you are using Ubuntu 8.04 or earlier, the package request has already been filed.
As an alternative to using SSH2, it's easier to mount a remote file system ( http://ubuntu.wordpress.com/2005/10/28/
how-to-mount-a-remote-ssh-filesystem-using-sshfs/ ) and use the standard php copy() unlink() etc files.