wget http://www.libssh2.org/download/libssh2-1.4.2.tar.gz
tar -zxvf libssh2-1.4.2.tar.gz
cd libssh2-1.4.2
./configure --prefix=/usr/local/libssh2
make && make install
wget http://pecl.php.net/get/ssh2-0.12.tgz
tar -zxvf ssh2-0.12.tgz
cd ssh2-0.12
phpize
./configure --prefix=/usr/local/ssh2 --with-ssh2=/usr/local/libssh2 --with-php-config=/usr/local/php/bin/php-config
make
#复制到php的扩展目录cp moduels/ssh2.so /usr/local/php/lib/php/extensions/no-debug-zts-20090626#修改php.ini 添加扩展
vi php.ini
添加 extension=ssh2.so# 重启php
/usr/local/php/sbin/php-fpm -t
/etc/init.d/php-fpm restart