- 安装openssl
- 安装libssh
wget http://www.libssh2.org/download/libssh2-1.2.7.tar.gz tar zxvf libssh2-1.2.7.tar.gz cd libssh2-1.2.7 ./configure make make install
- 安装php-ssh2
wget http://pecl.php.net/get/ssh2 tar zxvf ssh2-0.11.2.tgz cd ssh2-0.11.2 phpize ./configure --with-ssh2 --with-php-config=/usr/local/php/bin/php-config make
- 这时会显示编译好的ssh2.so的路径
- 在php.ini添加extensions=/path/to/your/so/ssh2.so
- 重启web server