1) Install needed packages:
yum install automake make php-devel libtool openssl-devel gcc++ gcc
2) Change directory (/usr/lib/php if you have a 32bit OS):
cd /usr/lib64/php
3) Download the source (latest as of 2013/02/28, check latest here):
wget
http://pecl.php.net/get/ssh2-0.12.tgz4) Create a build directory (I don't like mess in my system) and untar the package:
mkdir build-dir
mv ssh2-0.12.tgz build-dir
cd build-dir
tar xzvf ssh2-0.12.tgz
5) Prepare the compile step and compile:
phpize
./configure –with-ssh2
make
6) Copy the module in the system (/usr/lib/php/modules/ssh2.so if you have a 32bit OS):
cp modules/ssh2.so /usr/lib64/php/modules/ssh2.so
7) Change configuration and add this line to /etc/php.d/ssh2.ini (although I didn't need to do this on my setup, maybe because I had already done this in the past):
extension=ssh2.so

If you want you can delete the build directory:
cd ../../
rm -f build-dir