Guide to install PHP SSH2 module on cPanel Server

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.

/scripts/restartsrv_apache

 

Check if SSH2 PHP module is loaded or not by using the following command.

php -i | grep ssh2

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)