Solution : How to install ssh2 php7 extension.

Sanjog Kumar Dash
Oct 29, 2015 · 1 min read

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.


Hope this will solve your problem. If not, please share the problem you have faced. It will help others.

PHP 7 Tutorial

Learn and use php7 in 24 hour

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store