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.

Testing

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)
Last updated: 26th February 2021
First published: 16th August 2018

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch