PHP7.3.5安装ssh2扩展

环境里一直是跑PHP 7.1 版本,为了适应未来发展,现在升级为PHP 7.3.5但是发现无法安装SSH2扩展。
/ssh2-1.1.2/ssh2_fopen_wrappers.c:737:20: note: expected ‘char ’ but argument is of type ‘struct zend_string
static php_stream php_ssh2_exec_command(LIBSSH2_SESSION session, int resource_id, char command, char term, int term_len, zval environment, long width, long height, long type)
^
/ssh2-1.1.2/ssh2_fopen_wrappers.c: In function ‘php_ssh2_fopen_wrapper_scp’:
/ssh2-1.1.2/ssh2_fopen_wrappers.c:1024:2: warning: passing argument 3 of ‘php_ssh2_scp_xfer’ from incompatible pointer type [enabled by default]
stream = php_ssh2_scp_xfer(session, resource_id, resource->path);
^
/ssh2-1.1.2/ssh2_fopen_wrappers.c:970:20: note: expected ‘char
’ but argument is of type ‘struct zend_string
static php_stream
php_ssh2_scp_xfer(LIBSSH2_SESSION session, int resource_id, char filename)
^
/ssh2-1.1.2/ssh2_fopen_wrappers.c: In function ‘php_ssh2_fopen_wrapper_tunnel’:
/ssh2-1.1.2/ssh2_fopen_wrappers.c:1265:42: error: invalid operands to binary == (have ‘zend_string’ and ‘int’)
if (resource->path && resource->path[0] == '/') {
^
/ssh2-1.1.2/ssh2_fopen_wrappers.c:1268:8: warning: assignment from incompatible pointer type [enabled by default]
host = resource->path + 1;
^
make: *** [ssh2_fopen_wrappers.lo] Error 1

上面下载的是最新的ssh2-1.1.2版本,无奈只能使用最新的代码进行安装
yum -y install git libssh2-devel
git clone https://git.php.net/repository/pecl/networking/ssh2.git
cd ssh2
/usr/local/php7.3.5/bin/phpize
./configure --with-php-config=/usr/local/php7.3.5/bin/php-config
make
make install
echo "extension=ssh2.so">>/usr/local/php7.3.5/etc/php.ini
rm -rf ../ssh2

猜你喜欢

转载自blog.51cto.com/fengwan/2395669