Login to root user of the server on SSH.
Install package libssh2-devel on your server using the following command.
yum install libssh2-devel -y
Install ssh2 using PECL on the server with the following commands.
/usr/local/cpanel/3rdparty/bin/pecl install ssh2
Note: PECL Installer will ask libssh2 prefix, where we will press enter button without entering anything.
Now we need to enable the module in php.ini. Retrieve the php.ini location using the following command.
php -i | grep "Loaded Configuration File"
Run the following command to map the extension into PHP
echo "extension=ssh2.so" >> /opt/cpanel/ea-php56/root/etc/php.ini
Check if you have additional PHP versions on your server.
ls /opt/cpanel/ | grep ea-php
Repeat Step #5 for other PHP version installed on your server by replacing the php.ini file location.
Restart Apache web server.
Check if SSH2 PHP module is loaded or not by using the following command.
php -i | grep ssh2