当我用php 7.3安装最新的php sdk 3.1.2时,它运行得很好,但我的应用程序正在运行php 2.6 sdk,它不工作,并给我一个错误
/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
这是我的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
这是我的Couchbase.list文件
deb https://packages.couchbase.com/clients/c/repos/deb/ubuntu1804 bionic bionic/main
我还在我的PHP.ini上添加了扩展名,即extension=couchbase.so
请注意,如果我使用PHP SDK 3.1.2,一切都很好
如果有人在这里面临同样的问题,我已经解决了
FROM php:7.3.28-apache
RUN apt-get update
RUN apt-get install -y wget lsb-release gnupg2
RUN echo "deb http://packages.couchbase.com/ubuntu bionic bionic/main" | tee /etc/apt/sources.list.d/couchbase.list
RUN wget -O - http://packages.couchbase.com/ubuntu/couchbase.key | apt-key add -
RUN apt-get update
#RUN apt search libcouchbase
RUN apt-get install -y libcouchbase2-libevent libcouchbase-dev
RUN apt-get update
RUN pecl install https://packages.couchbase.com/clients/php/couchbase-2.6.2.tgz
COPY ./config/php/php.ini /usr/local/etc/php/
WORKDIR /var/www/html
COPY ./backend/ /var/www/html/
EXPOSE 80