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

https://pecl.php.net/package/ssh2/0.13 (from here)

LibSSH

https://www.libssh2.org/ (Any stable version)

Untar the Libssh

execute the below commands

./configure

make

make install

Untar the SSH2

execute the below commands

phpize

./configure

make

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

extension=ssh2.so

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.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp

libSSH Version => libssh2/1.4.2

ssh2

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

 

 

 

 

Comments are closed.