Solution : How to install ssh2 php7 extension

Solution : How to install ssh2 php7 extension.

php7 has lots of cool features. But before upgrading to php7 we must have tested whether all extensions works perfectly or not. Today I faced a strange error while installing ssh2 PECL package using pecl command.

After so much research I found the solution and like to share this with you people.


when I tried to install ssh2 php extension with php7 it showed me an error

pecl/ssh2 requires PHP (version >= 4.0.0, version <= 6.0.0), installed version is 7.0.0RC4


1- Install Linux package lib-ssh2 on your machine which is the only dependency for php-ssh2.

For ubuntu

sudo apt-get install libssh2–1-dev libssh2–1

From source

Download the source from lib ssh2 official site and install .

2- Download the php7 branch source of php ssh2 from


3- unzip the zip file.


4- Enter into the unzipped directory

cd pecl-networking-ssh2-php7

5- Prepare build environment for this extension using phpize. It will create all required file and folder structure and configure file for our extension


6- Then check configuration


7- Make our extension using

sudo make

8- Install the extension using

sudo make install.

Categories: linux, Php

Comments are closed.