08 Oct 2018

Guide to install PHP SSH2 module on cPanel Server

Wondering how to install PHP SSH2 module on cPanel Server? You are at the right place. Today, we will guide you with simple steps using which you can add PHP SSH2 module to your cPanel Server. This requires no prior knowledge or experience.

Let us discuss some requirements below

  • cPanel/WHM installed server
  • Root access to the Server on SSH

Procedure

  1. Login to root user of the server on SSH.
  2. Install package libssh2-devel on your server using the following command.
    yum install libssh2-devel -y
    install libss2-devel
  3. 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.
    install libssh2 using pecl
  4. 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"
    check php config file location
  5. Run the following command to map the extension into PHP
    echo "extension=ssh2.so" >> /opt/cpanel/ea-php56/root/etc/php.ini
  6. Check if you have additional PHP versions on your server.
    ls /opt/cpanel/ | grep ea-php
    check installed php versions
  7. Repeat Step #5 for other PHP version installed on your server by replacing the php.ini file location.
  8. Restart Apache web server.
    /scripts/restartsrv_apache
  9. Check if SSH2 PHP module is loaded or not by using the following command.
    php -i | grep ssh2
    check ssh2 module status

With this, we have finished the Installation of PHP SSH2 module on cPanel Server.