[ Enlarge Image ]  
 
 
<< Back 
Posted: 2006/03/24 by: fcruz. PHP programming Blogs.
Follow these steps to integrate SSH2 into PHP, this article describes how to use the SSH2 libraries as a PHP extension in case you need your applications to connect to an SSH / SSH2 server.

Install php ssh2


1. Download and install OpenSSL. If you install OpenSSL via your distribution's packaging system be sure to install the development libraries as well. This will typically be a package named openssl-dev, openssl_devel, or some variation thereof.
    

2.Download (http://sourceforge.net/projects/libssh2/) and install libssh2. Typically this means executing the following command from the libssh2 source tree. ./configure && make all install.

NOTE: If you get an error related to an -lgssapi_krb5 change the LDFLAGS path like this:


export LDFLAGS="-L/usr/kerberos/lib -lkrb5 -lgssapi_krb5 -lpam"

and run the configure and make commands as well
    
3. Run the pear installer for PECL/ssh2: pear install ssh2.
download the tarball from PECL (http://pecl.php.net/package/ssh2).
From the root of the unpacked tarball, run: phpize && ./configure --with-ssh2 && make to generate ssh2.so (ssh2x/modules/).

4. Copy ssh2.so from the directory indicated by the build process to the location specified in your php.ini file under extension_dir.
 
5. Add extension=ssh2.so to your php.ini
   
6. Restart your webserver to reload your php.ini settings.

7.Enjoy!

FYI: unpacked command tar –zxvf filename.tgz





[ Back ]