Install ssh2 pecl package on cPanel
PHP developers may want to use SFTP to transfer website assets and code to a cPanel server with their favorite programming language. This scenario may seem impossible if php throws an error when attempting to call the underlying SFTP software and server refuses to install the necessary dependencies.
Normally cPanel makes installation of PHP packages very easy to deal with via the “PHP Pecl Installer” menu. But in this case you may encounter an error similar to this one;
According to the error message the “ssh2” PHP package is missing a dependency. In order for PHP to interact with SFTP (as well as SSH) this dependency can be met by installing the “libssh2-devel” RPM with yum.
yum install libssh2-devel
Then install PHP “ssh2” package using the pecl binary shipped with cPanel.
/opt/cpanel/ea-php56/root/usr/bin/pecl install ssh2
If you really want to, this second step could also be accomplished through the WHM “pecl package Module Installer” menu. In any case, once these two steps are complete just restart Apache services and the PHP extension should be ready for use. A quick test to verify the php extension is loaded is to grep “ssh2” from the output of “php -i”.
As of this writing the top result from google about how to resolve this issue leads to a feature requests on the cPanel tracker which seems to indicate the ssh2 package will not work with php 5.6. However this issue is relatively easy to solve so long as you have shell access to the server with an account capable of using ‘’yum’’.