LCB_EINVAL: Invalid input/arguments


When running the example hello-couchbase.php provided here:

I get the following output (travel-sample bucket):

  • Storing u:king_arthur OK

  • Getting back u:king_arthur OK

  • Replacing u:king_arthur OK

  • Creating primary index: Couldn’t create index. Maybe it already exists? (code: 7)

  • Parameterized query KO
    object(Couchbase\N1qlQuery)#4 (3) {
    array(2) {
    string(43) “SELECT * FROM toto_ WHERE $p IN interests”
    string(16) “African Swallows”

    Fatal error: Uncaught Couchbase\Exception: LCB_EINVAL: Invalid input/arguments in /var/www/html/test.php:52
    Stack trace:
    #0 /var/www/html/test.php(52): Couchbase\Bucket->query(Object(Couchbase\N1qlQuery))
    #1 {main}
    thrown in /var/www/html/test.php on line 52

Docker images:

  • couchbase/server:6.0.1
  • php:7.1.20-fpm-alpine (with couchbase-2.6.0)


couchbase support => enabled
extension version => 2.6.0
libcouchbase runtime version => 2.10.3 (git: 0xdeadbeef)
libcouchbase headers version => 2.10.3 (git: 0xdeadbeef)
igbinary transcoder => disabled (install pecl/igbinary and rebuild pecl/couchbase)
zlib compressor => enabled

From web interface, runs perfectly.

Why I get this error ?

Fatal error: Uncaught Couchbase\Exception: LCB_EINVAL: Invalid input/arguments

your output seems to interlaced with some other commands? Could you uses markup here, in the editor to mark the sections of output, commands and the source code as preformatted?

Which line exactly is problematic for you? Could you make sure that both webserver and CLI are using the same php.ini?

My post was updated :slight_smile:
Couchbase script runs on one container. There are not two php.ini.

This is my Dockerfile:

FROM php:7.1.20-fpm-alpine
COPY ./www.conf /usr/local/etc/php-fpm.d/www.conf
RUN apk add --update --no-cache --virtual .install-bundler \
    alpine-sdk libxml2-dev libltdl $PHPIZE_DEPS $BUILD_DEPS &&\
    apk add --update --no-cache \
    gmp-dev imap-dev libmcrypt-dev zlib-dev gettext-dev &&\
    docker-php-ext-configure imap --with-imap &&\
    docker-php-ext-install gmp pdo_mysql imap bcmath xml soap calendar exif gettext mysqli zip pcntl &&\
    docker-php-source delete &&\
    pecl channel-update &&\
    pecl install --alldeps pcs-1.3.3 &&\
    echo "${ALPINE_MIRROR}/edge/main" >> /etc/apk/repositories &&\
    apk add --update libressl2.7-libcrypto &&\
    apk add 'libcouchbase-dev' --update-cache --repository &&\
    pecl install --alldeps couchbase-2.6.0 &&\
    echo '' >> /usr/local/etc/php/conf.d/igbinary.ini &&\
    echo '' >> /usr/local/etc/php/conf.d/couchbase.ini &&\
    apk del .install-bundler &&\
    rm -rf /var/cache/apk/* &&\
    rm -rf /tmp/pear ~/.pearrc &&\
    rm -rf /tmp/* &&\
    sed -i 's/#default_bits/default_bits/g' /etc/ssl/openssl.cnf &&\
    sed -i 's/#default_md/default_md/g' /etc/ssl/openssl.cnf
CMD ["php-fpm"]

My Docker container runs under Ubuntu 18.04.2 LTS.