PHP安装ssh2拓展

linux系统
注意:
1.安装前需要openssl

可以用which openssl看是否已安装

2.安装ssh2要先安装libssh2

安装开始
1.下载包

wget http://www.libssh2.org/download/libssh2-1.4.2.tar.gz$
wget http://pecl.php.net/get/ssh2-0.12.tgz
2.安装libssh2

*解压
tar -zxvf libssh2-1.4.2.tar.gz

*进入目录
cd libssh2-1.4.2

*配置 –prefix 是安装目录
./configure –prefix=/usr/local/libssh2

*编译 安装
make
make install

*安装完返回上级目录
cd ..
3.安装ssh2

*解压ssh2
tar -zxvf ssh2-0.12.tgz

*进入目录
cd ssh2-0.12

*执行phpize –宝塔的路径如下 56 为PHP的版本
/www/server/php/56/bin/phpize

*配置
–with-php-config 后面填写PHP config路径 –with-ssh2后面填libssh2的路径
./configure –prefix=/usr/local/ssh2 –with-ssh2=/usr/local/libssh2 –with-php-config=/www/server/php/56/bin/php-config

编译 安装
make
make时可能会报警告,警告可以忽略,直接make install
make install
4.修改php.ini 加入配置

extension=ssh2.so
重启PHP 保险起见,Nginx也重启

然后大功告成

未经允许不得转载:肥猫博客 » PHP安装ssh2拓展

赞 (0)
分享到: 更多

评论 0