Knowledgebase

Intalling PHP-SSH2 in CWP

This tutorial will help you to enable SSH2 in PHP.
1) Download and install libssh2.

wget http://www.libssh2.org/download/libssh2-1.5.0.tar.gz
tar zxvf libssh2-1.5.0.tar.gz
cd libssh2-1.5.0
./configure --enable-shared --with-gnu-ld
make
make install

 

3) Download and install ssh2.

wget https://pecl.php.net/get/ssh2-0.12.tgz
tar zxvf ssh2-0.12.tgz
cd ssh2-0.12
phpize
./configure --with-ssh2
make
make install

 

3) Enable ssh2 extension in PHP.

echo "extension=ssh2.so" >> /usr/local/php/php.ini

 

4) Check if its enabled properly.

php -i |grep ssh

OUTPUT

Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip, ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp
libssh2 version => 1.5.0
banner => SSH-2.0-libssh2_1.5.0
CVS_RSH => ssh
_SERVER["CVS_RSH"] => ssh
  • 4 Users Found This Useful
Was this answer helpful?