The current PHP ssh2 extension via PECL won't compile under PHP7.
Using a more recent version via PHP's GitHub we can make this work.
$ sudo apt-get install autoconf libssh2-1-dev
$ curl -LO https://github.com/php/pecl-networking-ssh2/archive/master.zip
$ unzip master.zip
$ cd pecl-networking-ssh2-master
$ phpize
$ ./configure
$ make
Extension will be available for use at ./modules/ssh2.so
.
What is phpize? Is it command? I cannot install it on Ubuntu 16.04:
Update: run command
sudo apt-get install php-dev
to obtain phpize command.When you will finish steps above you will have
ssh2.so
file in foldermodules
. Place it somewhere to path/usr/lib/php/20151012/
as aroot
and add thisextension=/usr/lib/php/20151012/ssh2.so
to the end of
php.ini
sudo nano /etc/php/7.0/fpm/php.ini
and restart PHP7
sudo service php7.0-fpm restart
Create phpinfo.php somewhere on your server
It should contains "ssh2" string.