Couchbase PHP SDK 2.6 on docker container

  couchbase, docker, dockerfile, php, ubuntu

When i install the latest php sdk 3.1.2 with PHP 7.3 it works perfectly but my app is working on PHP 2.6 SDK which is not working and giving me a error of

 /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-defaultusermvTqHw/couchbase-2.6.0/include -I/tmp/pear/temp/pear-build-defaultusermvTqHw/couchbase-2.6.0/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
In file included from /tmp/pear/temp/couchbase/couchbase.c:17:
/tmp/pear/temp/couchbase/couchbase.h:29:10: fatal error: libcouchbase/api3.h: No such file or directory
 #include <libcouchbase/api3.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:195: couchbase.lo] Error 1
ERROR: `make' failed
ERROR: Service 'php' failed to build: The command '/bin/sh -c pecl install https://packages.couchbase.com/clients/php/couchbase-2.6.0.tgz' returned a non-zero code: 1

Here is my Dockerfile

#FROM php:7.3.28-apache
FROM php:7.2-apache

RUN apt-get update

RUN apt-get install -y wget lsb-release gnupg2

RUN wget https://packages.couchbase.com/clients/c/repos/deb/couchbase.key

RUN apt-key  add couchbase.key

COPY ./config/couchbase.list /etc/apt/sources.list.d

RUN apt-get update

RUN apt search libcouchbase

RUN apt install -y libcouchbase3 libcouchbase-dev libcouchbase3-tools libcouchbase-dbg libcouchbase3-libev libcouchbase3-libevent

RUN pecl install https://packages.couchbase.com/clients/php/couchbase-2.6.0.tgz 

COPY ./config/php/php.ini /usr/local/etc/php/

WORKDIR /var/www/html

COPY ./backend/ /var/www/html/

EXPOSE 80

Here is my Couchbase.list file

deb https://packages.couchbase.com/clients/c/repos/deb/ubuntu1804 bionic bionic/main

i also added the extension on my PHP.ini which is extension=couchbase.so

Note that every things works fine if i use PHP SDK 3.1.2

Source: Docker Questions

LEAVE A COMMENT