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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章