When trying to install the extension ssh2 via pecl, I encounter the below error messages. I was using a docker container based on php:7.3.2-fpm
Steps to reproduce:
libssh2-1-dev
and libssh2-1
pecl install ssh2-1.1.2
So how can I successfully install the ssh2
extension?
...
/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
I found this question unanswered and put on hold on superusers when I first googled for it. I think its more suited here.
Theres an existing report on bugs.php.net, where user goldorakhong commented to compile it from source.
Using a docker file this can be done so:
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
If your not using docker you'll need to substitute docker-php-ext-enable
to register the variable somehow else.