[英]How to install ssh2 for php 7.3
嘗試通過 pecl 安裝擴展 ssh2 時,我遇到以下錯誤消息。 我使用的是基於php:7.3.2-fpm
的 docker 容器
重現步驟:
libssh2-1-dev
和libssh2-1
pecl install ssh2-1.1.2
安裝 ssh2 擴展那么如何才能成功安裝ssh2
擴展呢?
...
/tmp/pear/temp/ssh2/ssh2_fopen_wrappers.c: In function 'php_ssh2_fopen_wrapper_tunnel':
/tmp/pear/temp/ssh2/ssh2_fopen_wrappers.c:1265:42: error: invalid operands to binary == (have 'zend_string {aka struct _zend_string}' and 'int')
if (resource->path && resource->path[0] == '/') {
~~~~~~~~~~~~~~~~~ ^~
/tmp/pear/temp/ssh2/ssh2_fopen_wrappers.c:1268:8: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
host = resource->path + 1;
^
Makefile:196: recipe for target 'ssh2_fopen_wrappers.lo' failed
make: *** [ssh2_fopen_wrappers.lo] Error 1
ERROR: `make' failed
有一個關於bugs.php.net的現有報告,用戶goldorakhong評論說從源代碼編譯它。
使用 docker 文件可以這樣做:
RUN cd /tmp \
&& git clone https://git.php.net/repository/pecl/networking/ssh2.git \
&& cd /tmp/ssh2/ \
&& .travis/build.sh \
&& docker-php-ext-enable ssh2
如果您不使用 docker,則需要替換docker-php-ext-enable
以其他方式注冊變量。
Windows 2008 R2 64 位
Wampserver 3.1.9 64 位
PHP 7.3.12
1 - 從https://windows.php.net/downloads/pecl/releases/ssh2/下載 php_ssh2.dll 和 php_ssh2.pdb
2 - 選擇 2019 年 9 月 18 日上午 11:50 1.2
3 - 選擇 9/18/2019 10:45 AM 438049 php_ssh2-1.2-7.3-ts-vc15-x64.zip
4 - 解壓並復制 php_ssh2.dll 和 php_ssh2.pdb 到 C:/wamp64/bin/php/php7.3.12/ext/
5 - 在 php.ini 插入行:extension=php_ssh2.dll
6 - 在 wamp 中重啟所有服務
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.