Everything is harder on Centos, and that includes ssh2. If you’re having issues, here are the steps below.

1. First you have to install the following packages:
yum install automake make php-devel libtool openssl-devel gcc++ gcc

2. Next, change to the following directory:
cd /usr/lib64/php

3. Let’s create a build directory:
mkdir build-dir

4. Download the current version of ssh2. As of 11/04/15, it is ssh2-0.12:

wget http://pecl.php.net/get/ssh2-0.12.tgz
tar xzvf ssh2-0.12.tgz

4. Now, let’s prepare and compile:

phpize
./configure –-with-ssh2
make

5. Copy the module to your system:
cp modules/ssh2.so /usr/lib64/php/modules/ssh2.so

6. Edit your php.ini file:
nano /etc/php.d/ssh2.ini
make sure the file only contains this:
extension=ssh2.so

7. Cleanup (remove the build directory and extra files):

cd ../../
rm -f build-dir