PHP ssh2 module allows you to connect to SSH servers. On Cpanel servers, this module is not available under EasyApache. You need to install using PECL. The PECL module installer in WHM does not list this module. The module is available to download from

https://pecl.php.net/package/ssh2

To install it, log in to the Cpanel server as SSH user root or login to WHM as user root, go to Terminal.

Run the command

/opt/cpanel/ea-php74/root/bin/pecl install ssh2-1.3.1

This will install ssh2 module for PHP 7.4.

You can also specify the full download URL for the SSH2 module like

/opt/cpanel/ea-php74/root/bin/pecl install https://pecl.php.net/get/ssh2-1.3.1.tgz

If you need to install SSH module for another PHP version, change ea-php74 to whatever PHP version you are using. Make sure you select the appropriate ssh2 module version that works with the PHP version you are using.

After installing, restart Apache with

systemctl restart httpd

To verify the ssh2 module is installed, create a PHP file with phpinfo() function, you will see.

Cpanel php-ssh2 module phpinfo