Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu 16.04 - Install PHP SSH2 Extension

Installing PHP with the SSH2 extension for PHP 7.0 in Ubuntu 16.04 is as easy as:

sudo apt-get install php7.0-cli -y
sudo apt-get install libssh2-1 php-ssh2 -y

No need to install through PECL.


You can do the following to perform a quick test to check that SSH2 support has been added:

php -a
php > $result = ssh2_connect('localhost');
php > var_dump($result);
resource(2) of type (SSH2 Session)