Install ssh2 extension for PHP on DirectAdmin server

DirectAdmin PHP SSH2
DirectAdmin PHP SSH2

Introduction

The installation of php-ssh2 on DirectAdmin is very simple. Here is how I installed it. Please note that I used DirectAdmin 1.51.4, CentOS 7x64, and PHP 7.0 FPM on a Vultr server.

Prerequisites

  • A running DirectAdmin server.
  • Basic knowledge of Linux OS.

Installation

On CentOS, php-ssh2 requires libssh2-devel, so we install it:

yum install libssh2-devel

Next, install PHP SSH2:

cd /usr/local/src/
wget https://pecl.php.net/get/ssh2-1.1.tgz
tar -xzvf ssh2-1.1.tgz
cd ssh2-1.1
/usr/local/php70/bin/phpize
./configure --with-php-config=/usr/local/php70/bin/php-config
make && make install

Finally, update thephp.ini and restart Apache:

extension=ssh2.so

Conclusion

The SSH2 extension is now installed in your PHP DirectAdmin server.

Comments