繁体   English   中英

docker 和 couchbase sdk 安装

[英]docker and couchbase sdk install

所以我想在 docker 的 php 容器上安装 couchbase php sdk。 一切都很好,但有一个错误。 我有这个作为我的 Dockerfile:

FROM php:7.3-fpm

RUN docker-php-ext-install pdo_mysql pdo
RUN pecl install --alldeps xdebug couchbase
RUN docker-php-ext-enable xdebug libcouchbase couchbase

COPY docker/php-fpm/php.ini /usr/local/etc/php/conf.d/40-custom.ini

这就是最后发生的事情:

Build process completed successfully
Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.9.0
88 source files, building
running: phpize
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
building in /tmp/pear/temp/pear-build-defaultuserHHlcdZ/couchbase-2.6.1
running: /tmp/pear/temp/couchbase/configure --with-php-config=/usr/local/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -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
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20180731
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 1.1.1 (ok)
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable Couchbase support... yes, shared
checking wheter to use system FastLZ library... no
checking for libcouchbase in default path... not found
configure: error: Please reinstall the libcouchbase distribution -
                 libcouchbase.h should be <libcouchbase-dir>/include and
                 libcouchbase.a should be in <libcouchbase-dir>/lib
ERROR: `/tmp/pear/temp/couchbase/configure --with-php-config=/usr/local/bin/php-config' failed
ERROR: Service 'php' failed to build: The command '/bin/sh -c pecl install --alldeps xdebug couchbase' returned a non-zero code: 1

问题出在 couchbase php 扩展上。 为什么会这样?

我试过使用 apt-get 安装它,但还有其他错误。

我在 Apple M1 MacBook Air 上安装 couchbase PHP SDK 时遇到了类似的错误。 我已经安装了libcouchbase

brew install libcouchbase

我还必须安装pkg-config ,couchbase PHP SDK 安装程序可以使用它来解析libcouchbase路径:

brew install pkg-config

之后,php SDK 安装程序没有libcouchbase in default path... not found抛出libcouchbase in default path... not found错误

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

但是编译在后期失败了。 我发现pkg-config libcouchbase --libs没有返回正确的目录,所以我检查了libcouchbase.pc的设置并注意到libdir没有正确设置。 要找出我使用的libcouchbase.pc的路径:

brew info libcouchbase

libcouchbase.pc位于{libcouchbase_install_path}/lib/pkgconfig/libcouchbase.pc 修改libdir属性的值后,文件内容如下所示:

prefix=/opt/homebrew/Cellar/libcouchbase/3.1.1
exec_prefix=/opt/homebrew/Cellar/libcouchbase/3.1.1
includedir=/opt/homebrew/Cellar/libcouchbase/3.1.1/include
libdir=/opt/homebrew/Cellar/libcouchbase/3.1.1/lib

Name: libcouchbase 3.1.1
Description: Couchbase client library
Version: 3.1.1
Libs: -L${libdir} -lcouchbase
Cflags: -I${includedir}

最后,运行 php SDK 安装程序效果很好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM