Unable to install Couchbase PHP SDK

Hello, i’m having a hard time installing PHP SDK on my Plesk server which is running Centos 7.9.2009.

Can anyone help pinpoint what the cause is?
cmake 3.17.5

cbc:
Runtime: Version=3.2.4, Changeset=38cc0708dfcc5a706c6b21dc80bcd84f05890225
Headers: Version=3.2.4, Changeset=38cc0708dfcc5a706c6b21dc80bcd84f05890225
Build Timestamp: 2021-11-26 10:42:22
Default plugin directory: /usr/lib64/libcouchbase
IO: Default=libevent, Current=libevent, Accessible=libevent,select
SSL Runtime: OpenSSL 1.0.2k-fips 26 Jan 2017
SSL Headers: OpenSSL 1.0.2k-fips 26 Jan 2017
HAVE_PKCS5_PBKDF2_HMAC: yes
Snappy: 1.1.8
Tracing: SUPPORTED
System: Linux-5.14.18-300.fc35.x86_64; x86_64
CC: GNU 8.3.1; -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fno-strict-aliasing -ggdb3 -pthread
CXX: GNU 8.3.1; -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fno-strict-aliasing -ggdb3 -pthread

/opt/plesk/php/8.1/bin/pecl install couchbase

...(everything seems good above, no errors)
configure: creating ./config.status

CMAKE                  : /usr/local/bin/cmake
CMAKE_SOURCE_DIRECTORY : /tmp/couchbase/src
CMAKE_BUILD_DIRECTORY  : /tmp/pear-build-root0loxL7/couchbase-4.0.0/cmake-build
CMAKE_C_COMPILER       : /usr/local/bin/gcc
CMAKE_CXX_COMPILER     : /usr/local/bin/g++
CMAKE_C_FLAGS          : -g -O2
CMAKE_CXX_FLAGS        : -g -O2 -std=c++17
COUCHBASE_PHP_INCLUDES : -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
COUCHBASE_PHP_LDFLAGS  :
COUCHBASE_PHP_LIBDIR   : /tmp/pear-build-root0loxL7/couchbase-4.0.0/modules

-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/bin/g++
-- Check for working CXX compiler: /usr/local/bin/g++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMake version 3.17.5
-- Couchbase C++ client 1.0.0.0
-- CMAKE_SOURCE_DIR=/tmp/couchbase/src
-- CMAKE_BINARY_DIR=/tmp/pear-build-root0loxL7/couchbase-4.0.0/cmake-build
CMake Warning at deps/couchbase-cxx-client/cmake/Cache.cmake:28 (message):
  ccache is enabled but was not found.  Not using it
Call Stack (most recent call first):
  deps/couchbase-cxx-client/CMakeLists.txt:37 (include)


-- Looking for backtrace
-- Looking for backtrace - found
-- Looking for dladdr
-- Looking for dladdr - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Adding PEGTL as submodule from external/PEGTL
-- Using std::filesystem
-- Module support is disabled.
-- Version: 8.0.1
-- Build type: RelWithDebInfo
-- CXX_STANDARD: 17
-- Performing Test has_std_17_flag
-- Performing Test has_std_17_flag - Success
-- Performing Test has_std_1z_flag
-- Performing Test has_std_1z_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Success
-- Required features: cxx_variadic_templates
-- Looking for strtod_l
-- Looking for strtod_l - not found
-- Build spdlog: 1.9.2
-- Build type: RelWithDebInfo
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Searching 16 bit integer - Using unsigned short
-- Check if the system is big endian - little endian
-- Looking for byteswap.h
-- Looking for byteswap.h - found
-- Looking for sys/endian.h
-- Looking for sys/endian.h - not found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/uio.h
-- Looking for sys/uio.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for windows.h
-- Looking for windows.h - not found
-- Looking for zlibVersion in z
-- Looking for zlibVersion in z - found
-- Looking for lzo1x_1_15_compress in lzo2
-- Looking for lzo1x_1_15_compress in lzo2 - not found
-- Performing Test HAVE_VISUAL_STUDIO_ARCH_AVX
-- Performing Test HAVE_VISUAL_STUDIO_ARCH_AVX - Failed
-- Performing Test HAVE_VISUAL_STUDIO_ARCH_AVX2
-- Performing Test HAVE_VISUAL_STUDIO_ARCH_AVX2 - Failed
-- Performing Test HAVE_CLANG_MAVX
-- Performing Test HAVE_CLANG_MAVX - Success
-- Performing Test HAVE_CLANG_MBMI2
-- Performing Test HAVE_CLANG_MBMI2 - Success
-- Performing Test HAVE_BUILTIN_EXPECT
-- Performing Test HAVE_BUILTIN_EXPECT - Success
-- Performing Test HAVE_BUILTIN_CTZ
-- Performing Test HAVE_BUILTIN_CTZ - Success
-- Performing Test SNAPPY_HAVE_SSSE3
-- Performing Test SNAPPY_HAVE_SSSE3 - Failed
-- Performing Test SNAPPY_HAVE_BMI2
-- Performing Test SNAPPY_HAVE_BMI2 - Failed
-- Looking for mmap
-- Looking for mmap - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.7")
-- Looking for ceil in m
-- Looking for ceil in m - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Found OpenSSL: /usr/lib64/libcrypto.so (found version "1.0.2k")
-- OPENSSL_VERSION: 1.0.2k
-- OPENSSL_INCLUDE_DIR: /usr/include
-- OPENSSL_LIBRARIES: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so
-- Using std::filesystem
CMake Warning (dev) at deps/couchbase-cxx-transactions/CMakeLists.txt:83:
  Syntax Warning in cmake code at column 58

  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Getting SHA...
fatal: Not a git repository (or any of the parent directories): .git
-- PHP_INCLUDE_DIRS: ;/usr/include/php;/usr/include/php/main;/usr/include/php/TSRM;/usr/include/php/Zend;/usr/include/php/ext;/usr/include/php/ext/date/lib
-- COUCHBASE_PHP_CFLAGS:
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    COUCHBASE_PHP_LDFLAGS


-- Build files have been written to: /tmp/pear-build-root0loxL7/couchbase-4.0.0/cmake-build
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/sh /tmp/pear-build-root0loxL7/couchbase-4.0.0/libtool --mode=compile /usr/local/bin/g++  -I. -I/tmp/couchbase -DPHP_ATOM_INC -I/tmp/pear-build-root0loxL7/couchbase-4.0.0/include -I/tmp/pear-build-root0loxL7/couchbase-4.0.0/main -I/tmp/couchbase -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -std=c++17   -c /tmp/couchbase/src/php_couchbase.cxx -o src/php_couchbase.lo
libtool: compile:  /usr/local/bin/g++ -I. -I/tmp/couchbase -DPHP_ATOM_INC -I/tmp/pear-build-root0loxL7/couchbase-4.0.0/include -I/tmp/pear-build-root0loxL7/couchbase-4.0.0/main -I/tmp/couchbase -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -std=c++17 -c /tmp/couchbase/src/php_couchbase.cxx  -fPIC -DPIC -o src/.libs/php_couchbase.o
/tmp/couchbase/src/php_couchbase.cxx: In function 'void zim_CouchbaseException_getContext(zend_execute_data*, zval*)':
/tmp/couchbase/src/php_couchbase.cxx:67:5: error: 'ZVAL_COPY_DEREF' was not declared in this scope; did you mean 'ZVAL_OPT_DEREF'?
   67 |     ZVAL_COPY_DEREF(return_value, prop);
      |     ^~~~~~~~~~~~~~~
      |     ZVAL_OPT_DEREF
make: *** [src/php_couchbase.lo] Error 1
rolling back 958 file operations
ERROR: `make' failed

Thanks!

Try these commands:

echo $'[couchbase]\nenabled = 1\nname = libcouchbase package for centos8 x86_64\nbaseurl = https://packages.couchbase.com/clients/c/repos/rpm/el7/x86_64\ngpgcheck = 1\ngpgkey = https://packages.couchbase.com/clients/c/repos/rpm/couchbase.key' > /etc/yum.repos.d/couchbase.repo
yum -y --disablerepo=remi-safe install libcouchbase3 libcouchbase-devel libcouchbase3-tools libcouchbase3-libevent
cd /tmp ; wget https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0.tar.gz; tar zxvf cmake-3.* ;cd cmake-3.* ;./bootstrap --prefix=/usr ; make -j$(nproc) ; make install ; 
yum -y install devtoolset-11-gcc-c++ ; scl enable devtoolset-11 bash ;
pecl install https://pecl.php.net/get/couchbase-4.0.0.tgz ; 
echo "extension=couchbase.so" > /etc/php.d/25-couchbase.ini

restart php-fpm if you use that?

I uninstalled all of the libcouchbase* and reinstalled just the latest lastnight, so ill skip your first two commands.

 yum list installed *couchbase*
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: centos.mirror.globo.tech
 * epel: mirror.dst.ca
 * extras: centos.mirror.globo.tech
 * remi-php72: mirror.team-cymru.com
 * remi-safe: mirror.team-cymru.com
 * updates: centos.mirror.globo.tech
Installed Packages
libcouchbase-devel.x86_64                                                     3.3.2-1.el7                                                  @couchbase
libcouchbase3.x86_64                                                          3.3.2-1.el7                                                  @couchbase
libcouchbase3-libev.x86_64                                                    3.3.2-1.el7                                                  @couchbase
libcouchbase3-libevent.x86_64                                                 3.3.2-1.el7                                                  @couchbase
libcouchbase3-tools.x86_64                                                    3.3.2-1.el7                                                  @couchbase

cmake build resulted in:

......
/tmp/cmake-3.24.0/Bootstrap.cmk/cmake: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /tmp/cmake-3.24.0/Bootstrap.cmk/cmake)
/tmp/cmake-3.24.0/Bootstrap.cmk/cmake: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /tmp/cmake-3.24.0/Bootstrap.cmk/cmake)
/tmp/cmake-3.24.0/Bootstrap.cmk/cmake: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /tmp/cmake-3.24.0/Bootstrap.cmk/cmake)
/tmp/cmake-3.24.0/Bootstrap.cmk/cmake: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /tmp/cmake-3.24.0/Bootstrap.cmk/cmake)
---------------------------------------------
Error when bootstrapping CMake:
Problem while running initial CMake
---------------------------------------------
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install'.  Stop.

I’ll pause here as i was also thinking that it might be an issue with cmake, although i have it installed already?

cmake --version
cmake3 version 3.17.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Another thing i noticed is that GNU is reporting as 4.8.5 in cbc, but 11.3.0 is installed. How do i fix this?

cbc version
cbc:
  Runtime: Version=3.3.2, Changeset=34a9a23b6ddd76379c75d06a70629717e583c9f8
  Headers: Version=3.3.2, Changeset=34a9a23b6ddd76379c75d06a70629717e583c9f8
  Build Timestamp: 2022-08-29 12:10:42
  Default plugin directory: /usr/lib64/libcouchbase
  IO: Default=libevent, Current=libevent, Accessible=libevent,libev,select
  SSL Runtime: OpenSSL 1.1.1k  FIPS 25 Mar 2021
  SSL Headers: OpenSSL 1.1.1k  FIPS 25 Mar 2021
  HAVE_PKCS5_PBKDF2_HMAC: yes
  Snappy: 1.1.8
  Tracing: SUPPORTED
  System: Linux-4.15.0-91-generic; x86_64
  CC: GNU 4.8.5; -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fno-strict-aliasing -ggdb3 -pthread
  CXX: GNU 4.8.5; -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -fno-strict-aliasing -ggdb3 -pthread
[root@Pleskware-01 cmake-3.24.0]#

 gcc --version
gcc (GCC) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thanks so much for helping!

I am not sure exactly what problems are in your OS, but I just did a fresh installation on a clean Centos 7.9 minimal, and this is what worked for me:

you can copy the entire list of commands and should work without any intervention. Pay attention to the comment related to the PHP installation below.

echo $'[couchbase]\nenabled = 1\nname = libcouchbase package for centos8 x86_64\nbaseurl = https://packages.couchbase.com/clients/c/repos/rpm/el7/x86_64\ngpgcheck = 1\ngpgkey = https://packages.couchbase.com/clients/c/repos/rpm/couchbase.key' > /etc/yum.repos.d/couchbase.repo;

yum -y install epel-release ;
yum -y update;
yum -y install libcouchbase3 libcouchbase-devel libcouchbase3-tools libcouchbase3-libevent;

yum -y install centos-release-scl-rh openssl-devel;
yum -y install devtoolset-11-gcc-c++;
scl enable devtoolset-11 bash;

cd /tmp; 
wget https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0.tar.gz;
tar zxvf cmake-3.*;
cd cmake-3.*;
./bootstrap --prefix=/usr;
make -j$(nproc);
make install; 

# you may not need the next two lines if you already have php installed. But I had to install it to have "pecl" installed. 

yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm;
yum -y install --enablerepo=remi-php80 php php-pear;

yum -y install --enablerepo=remi-php80 php-devel;
pecl install https://pecl.php.net/get/couchbase-4.0.0.tgz;
echo "extension=couchbase.so" > /etc/php.d/25-couchbase.ini
1 Like

This seems to be working well as you have it, kudos!

Im going to try and update the plesk php builds now.

The following is building now finally, it failed before so i ran the last 3 lines you recommended.

/opt/plesk/php/8.0/bin/pecl install https://pecl.php.net/get/couchbase-4.0.0.tgz;

What do you think the equivalent of this would be for the plesk php installs?

echo "extension=couchbase.so" > /etc/php.d/25-couchbase.ini

Thanks again!

My pleasure.

Finally I have been able to help somebody on this forum :slight_smile:

I think you should search for the “Dynamic Extensions” in your php.ini file and there you should find the

directory from which your PHP is trying to get these ini files

quote from PHP.ini file:

Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.

Basically, that command is adding a line containing extension=couchbase.so into the file /etc/php.d/25-couchbase.ini This file may be in a different location in a Plesk installation

Based on this url: https://support.plesk.com/hc/en-us/articles/360005875373-How-to-add-additional-PHP-module-for-PHP-engines-shipped-with-Plesk-on-Linux-

you should run something like:

echo "extension=couchbase.so" > /opt/plesk/php/8.0/etc/php.d/25-couchbase.ini

you can check if is enabled:

/opt/plesk/php/8.0/bin/php -m | grep couchbase

and to refresh the information in Plesk you should run:

plesk bin php_handler --reread

and

plesk sbin packagemng -sdf

after this it should appear in Plesk under **Tools & Settings > PHP Settings > PHP 8

1 Like

I really appreciate it, you’re a sharpshooter!

The install complete for 7.4 as well, but it doesnt seem to be loading properly.

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/tmp/pear-build-rootqREgkG/install-couchbase-4.0.0" install
Installing shared extensions:     /tmp/pear-build-rootqREgkG/install-couchbase-4.0.0/usr/lib64/php/modules/
running: find "/tmp/pear-build-rootqREgkG/install-couchbase-4.0.0" | xargs ls -dils
922550      4 drwxr-xr-x. 3 root root      4096 Oct 19 16:27 /tmp/pear-build-rootqREgkG/install-couchbase-4.0.0
922560      4 drwxr-xr-x. 3 root root      4096 Oct 19 16:27 /tmp/pear-build-rootqREgkG/install-couchbase-4.0.0/usr
922562      4 drwxr-xr-x. 3 root root      4096 Oct 19 16:27 /tmp/pear-build-rootqREgkG/install-couchbase-4.0.0/usr/lib64
922564      4 drwxr-xr-x. 3 root root      4096 Oct 19 16:27 /tmp/pear-build-rootqREgkG/install-couchbase-4.0.0/usr/lib64/php
922565      4 drwxr-xr-x. 2 root root      4096 Oct 19 16:27 /tmp/pear-build-rootqREgkG/install-couchbase-4.0.0/usr/lib64/php/modules
922566   2280 -rwxr-xr-x. 1 root root   2334256 Oct 19 16:27 /tmp/pear-build-rootqREgkG/install-couchbase-4.0.0/usr/lib64/php/modules/couchbase.so
922567 240744 -rwxr-xr-x. 1 root root 246518664 Oct 19 16:27 /tmp/pear-build-rootqREgkG/install-couchbase-4.0.0/usr/lib64/php/modules/libcouchbase_php_core.so

Build process completed successfully
Installing '/usr/lib64/php/modules/libcouchbase_php_core.so'
Installing '/usr/lib64/php/modules/couchbase.so'
about to commit 962 file operations for couchbase
successfully committed 962 file operations
install ok: channel://pecl.php.net/couchbase-4.0.0
Extension couchbase enabled in php.ini
[*removed*]# echo "extension=couchbase.so" > /opt/plesk/php/7.4/etc/php.d/25-couchbase.ini
[*removed*]# /opt/plesk/php/7.4/bin/php -m
PHP Warning:  PHP Startup: Unable to load dynamic library 'couchbase.so' (tried: /opt/plesk/php/7.4/lib64/php/modules/couchbase.so (/opt/plesk/php/7.4/lib64/php/modules/couchbase.so: cannot open shared object file: No such file or directory), /opt/plesk/php/7.4/lib64/php/modules/couchbase.so.so (/opt/plesk/php/7.4/lib64/php/modules/couchbase.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
Core
ctype

Should i just copy it from the shared folder mentioned above? I feel like it should be easier than this, but i guess not…

[*removed*]# cp /usr/lib64/php/modules/couchbase.so /opt/plesk/php/7.4/lib64/php/modules/couchbase.so
[*removed*]# /opt/plesk/php/7.4/bin/php -m | grep couchbase
PHP Warning:  PHP Startup: couchbase: Unable to initialize module
Module compiled with module API=20200930
PHP    compiled with module API=20190902

Ive dealt with this before… I’ll install v3.3.2 for php 7.4.

Its working for 8.0

[*removed*]# echo "extension=couchbase.so" > /opt/plesk/php/8.0/etc/php.d/25-couchbase.ini
[*removed*]# /opt/plesk/php/8.0/bin/php -m | grep couchbase
couchbase

Thanks again!

Hmm, I think it has compiled with php8 instead of php7.4 but I am not sure of this.

have you used /opt/plesk/php/7.4/bin/pecl to compile couchbase?

I think you could run something like this

pecl config-set ext_dir /opt/plesk/php/7.4/lib64/php/modules/

I recompiled it with 7.4 and it gives the same error. I believe its using php from outside of the plesk folders somehow since PHP8 is what was installed “globally” using your string of commands.

I see this when compiling from the plesk 7.4 folder

renamed source file /tmp/couchbase/.tmpconfig.m4 to /tmp/couchbase/config.m4
1830 source files, building
building in /tmp/couchbase
running: phpize
Configuring for:
PHP Api Version:         20200930
Zend Module Api No:      20200930
Zend Extension Api No:   420200930

Its not the biggest of problems though, i want to upgrade to php8 anyway so ill just focus on that now instead of getting 7 to work.

phpize was missing from the 7.4 folder so i guess it was falling back to the global phpize.

This fixed it.

yum install plesk-php74-devel.x86_64
.....
 ./phpize --version
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902

And yes, couchbase is compiling properly now for 7.4 :slight_smile:

I can finally shift out of first gear!