Installing Couchbase in Dockerr on PHP78.1

Hi there,

I’m trying to get Couchbase installed in a docker image and having a few issues the pecl package build using PHP 7.4 but not 7.1. Below is the Dockerfile for 7.1 (FPM uses debian/buster)

FROM php:7.1-fpm
COPY php.ini /usr/local/etc/php/php.ini
COPY xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
RUN apt-get update && \
    apt-get install -y libzip-dev \
        libjpeg62-turbo-dev \
        libicu-dev \
        libpng-dev \
        gnupg2 \
        lsb-release \
        software-properties-common \
        build-essential
RUN curl https://packages.couchbase.com/clients/c/repos/deb/couchbase.key | apt-key add && \
    apt-add-repository 'deb https://packages.couchbase.com/clients/c/repos/deb/debian10 buster buster/main' && \
    apt-get update && \
    apt-get install -y libcouchbase-dev libcouchbase3-libevent libcouchbase3-tools
RUN docker-php-ext-install intl pdo_mysql zip gd
RUN pecl install xdebug
RUN pecl install https://packages.couchbase.com/clients/php/couchbase-3.0.3.tgz
RUN apt-get clean && apt-get purge

Error I get is as follows

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/couchbase -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/include -I/tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/main -I/tmp/pear/temp/couchbase -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/couchbase/couchbase.c -o couchbase.lo
mkdir .libs
 cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/couchbase -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/include -I/tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/main -I/tmp/pear/temp/couchbase -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/couchbase/couchbase.c  -fPIC -DPIC -o .libs/couchbase.o
/bin/bash /tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/couchbase -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/include -I/tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/main -I/tmp/pear/temp/couchbase -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/couchbase/exception.c -o exception.lo
 cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/couchbase -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/include -I/tmp/pear/temp/pear-build-defaultuserrxEYOy/couchbase-3.0.3/main -I/tmp/pear/temp/couchbase -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/couchbase/exception.c  -fPIC -DPIC -o .libs/exception.o
/tmp/pear/temp/couchbase/exception.c:74:72: error: macro "ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO" requires 4 arguments, but only 3 given
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ai_BaseException_ref, IS_STRING, 1)
                                                                        ^
In file included from /usr/local/include/php/main/php.h:39,
                 from /tmp/pear/temp/couchbase/couchbase.h:25,
                 from /tmp/pear/temp/couchbase/exception.c:17:
/usr/local/include/php/Zend/zend_API.h:120:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '}' token
 #define ZEND_END_ARG_INFO()  };
                              ^
/tmp/pear/temp/couchbase/exception.c:75:1: note: in expansion of macro 'ZEND_END_ARG_INFO'
 ZEND_END_ARG_INFO()
 ^~~~~~~~~~~~~~~~~
/tmp/pear/temp/couchbase/exception.c:77:76: error: macro "ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO" requires 4 arguments, but only 3 given
 ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ai_BaseException_context, IS_OBJECT, 1)
                                                                            ^
In file included from /usr/local/include/php/main/php.h:39,
                 from /tmp/pear/temp/couchbase/couchbase.h:25,
                 from /tmp/pear/temp/couchbase/exception.c:17:
/usr/local/include/php/Zend/zend_API.h:120:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '}' token
 #define ZEND_END_ARG_INFO()  };
                              ^
/tmp/pear/temp/couchbase/exception.c:78:1: note: in expansion of macro 'ZEND_END_ARG_INFO'
 ZEND_END_ARG_INFO()
 ^~~~~~~~~~~~~~~~~
In file included from /usr/local/include/php/main/php.h:39,
                 from /tmp/pear/temp/couchbase/couchbase.h:25,
                 from /tmp/pear/temp/couchbase/exception.c:17:
/tmp/pear/temp/couchbase/exception.c:85:32: error: 'ai_BaseException_ref' undeclared here (not in a function); did you mean 'zim_BaseException_ref'?
     PHP_ME(BaseException, ref, ai_BaseException_ref, ZEND_ACC_PUBLIC)
                                ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/php/Zend/zend_API.h:70:75: note: in definition of macro 'ZEND_FENTRY'
 #define ZEND_FENTRY(zend_name, name, arg_info, flags) { #zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
                                                                           ^~~~~~~~
/usr/local/include/php/main/php.h:363:25: note: in expansion of macro 'ZEND_ME'
 #define PHP_ME          ZEND_ME
                         ^~~~~~~
/tmp/pear/temp/couchbase/exception.c:85:5: note: in expansion of macro 'PHP_ME'
     PHP_ME(BaseException, ref, ai_BaseException_ref, ZEND_ACC_PUBLIC)
     ^~~~~~
/tmp/pear/temp/couchbase/exception.c:86:36: error: 'ai_BaseException_context' undeclared here (not in a function); did you mean 'zim_BaseException_context'?
     PHP_ME(BaseException, context, ai_BaseException_context, ZEND_ACC_PUBLIC)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/php/Zend/zend_API.h:70:75: note: in definition of macro 'ZEND_FENTRY'
 #define ZEND_FENTRY(zend_name, name, arg_info, flags) { #zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
                                                                           ^~~~~~~~
/usr/local/include/php/main/php.h:363:25: note: in expansion of macro 'ZEND_ME'
 #define PHP_ME          ZEND_ME
                         ^~~~~~~
/tmp/pear/temp/couchbase/exception.c:86:5: note: in expansion of macro 'PHP_ME'
     PHP_ME(BaseException, context, ai_BaseException_context, ZEND_ACC_PUBLIC)
     ^~~~~~
/tmp/pear/temp/couchbase/exception.c: In function 'zim_BaseException_context':
/tmp/pear/temp/couchbase/exception.c:391:9: warning: implicit declaration of function 'zend_parse_parameters_none_throw'; did you mean 'zend_parse_parameters_throw'? [-Wimplicit-function-declaration]
     if (zend_parse_parameters_none_throw() == FAILURE) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         zend_parse_parameters_throw
make: *** [Makefile:197: exception.lo] Error 1
ERROR: `make' failed

But 7.4 works fine see Docker file below

FROM php:7.4-fpm
COPY php.ini /usr/local/etc/php/php.ini
COPY couchbase.key /tmp/couchbase.key
COPY xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
RUN apt-get update && \
    apt-get install -y libzip-dev \
        libjpeg62-turbo-dev \
        libicu-dev \
        libpng-dev \
        gnupg2 \
        lsb-release \
        software-properties-common \
        build-essential && \
    apt-key add /tmp/couchbase.key && \
    apt-add-repository 'deb https://packages.couchbase.com/clients/c/repos/deb/debian10 buster buster/main' && \
    apt-get update && \
    apt-get install -y libcouchbase-dev libcouchbase3-libevent libcouchbase3-tools
RUN docker-php-ext-install intl pdo_mysql zip gd
RUN pecl install xdebug
RUN pecl install https://packages.couchbase.com/clients/php/couchbase-3.0.3.tgz
RUN apt-get clean && apt-get purge

I can’t find anything that says couchbase does nbot work on 7.1, any help appreciated

Hello, me again… first of all sorry about the mess up in the title. I got Couchbase 2.6 working with 7.1-fpm-stretch

FROM php:7.1-fpm-stretch
COPY php.ini /usr/local/etc/php/php.ini
COPY xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
COPY couchbase.ini /usr/local/etc/php/conf.d/couchbase.ini
RUN apt-get update && \
    apt-get install -y libzip-dev \
        libjpeg62-turbo-dev \
        libicu-dev \
        libpng-dev \
        gnupg2 \
        lsb-release
RUN curl -O http://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-6-amd64.deb && \
    dpkg -i couchbase-release-1.0-6-amd64.deb && \
    apt-get update && \
    apt-get install -y libcouchbase-dev
RUN docker-php-ext-install intl pdo_mysql zip gd
RUN pecl install xdebug
RUN pecl install https://packages.couchbase.com/clients/php/couchbase-2.6.2.tgz
RUN apt-get clean && apt-get purge

So for anyone that has been having issues with PHP7.1 you can use the above Docker file to build yourself a 2.6 version of the API, it may not be totally optimised for your particular PHP instance. Plus I thought it might be useful to the devs to know what I have got working.