宝塔安装ssh2扩展

1、先安装必要的系统组件

yum install -y libssh2.x86_64 php-pecl-ssh2.x86_64
yum install -y openssl
yum install -y openssl-devel

2、下载安装包,先安装libssh2再安装ssh2

wget https://www.libssh2.org/download/libssh2-1.8.0.tar.gz
wget https://pecl.php.net/get/ssh2-1.1.2.tgz

3、开始安装libssh2

tar -zxvf libssh2-1.8.0.tar.gz
cd libssh2-1.8.0
./configure --prefix=/usr/local/libssh2
make && make install

4、开始编译安装ssh2

cd /root
tar -zxvf ssh2-1.1.2.tgz
cd ssh2-1.1.2
/www/server/php/72/bin/phpize
./configure --prefix=/usr/local/ssh2 --with-ssh2=/usr/local/libssh2 --with-php-config=/www/server/php/72/bin/php-config
make && make install

5、修改配置文件添加扩展加载文件路径

vi /www/server/php/72/etc/php.ini
复制这行粘帖到追尾行

extension=/www/server/php/72/lib/php/extensions/no-debug-non-zts-20170718/ssh2.so

6、重启apache服务

/etc/init.d/httpd restart

7、重启php服务

/etc/init.d/php-fpm-72 restart

你可能感兴趣的:(宝塔安装ssh2扩展)