PHP安装 ssh2 来支持sftp

Centos 安装:

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

tar -xvzf ssh2-1.2.tgz -C .
tar -zxvf libssh2-1.9.0.tar.gz -C .

cd libssh2-1.9.0
./configure --prefix=/usr/local/libssh2
make && make install

cd ../ssh2-1.2
/usr/local/php/bin/phpize
./configure --prefix=/usr/local/ssh2 --with-ssh2=/usr/local/libssh2 --with-php-config=/usr/local/php/bin/php-config
make && make install

cp modules/ssh2.so /usr/lib64/php/modules/

echo "extension=ssh2.so" >> /usr/local/php/etc/php.ini

查询一下
/usr/local/php/bin/php -m|grep ssh2

macOS安装:
brew install libssh2
pecl install ssh2-1.2

参考资料:
Call to undefined function ssh2_connect();安装ssh2:https://blog.csdn.net/weixin_33721427/article/details/93010916

SSH2 for PHP7 MacOS?
:https://stackoverflow.com/questions/49886490/ssh2-for-php7-macos

发表评论?

0 条评论。

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据