PHP-SSH2 with php7

Install PHP-SSH2 with PHP7

As we cannot do pecl install ssh2 for php7 version because its not available beyond php6

Downlaod the LIb-ssh2 and PHP-SSH2

PHP-SSH2 (from here)

LibSSH (Any stable version)

Untar the Libssh

execute the below commands



make install

Untar the SSH2

execute the below commands




make install

You installed the lib and ssh2 successfully

You need to add extension in php.ini file and check wether everything is working fine or not

vi /etc/php.ini

add following line at end

save and file and exit

now check the SSH2 is installed with php or not

php -i |grep ssh2

it should show something like this

Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, zip,, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp

libSSH Version => libssh2/1.4.2


libssh2 version => 1.8.0

banner => SSH-2.0-libssh2_1.8.0

If you get above output then restart the apache to get SSH2 work with PHP





Categories: linux, Php

Comments are closed.