LCB_EINVAL: Invalid input/arguments

Hi,

When running the example hello-couchbase.php provided here:
http://developer.couchbase.com/documentation/server/current/sdk/php/start-using-sdk.html

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) {
    [“options”]=>
    array(2) {
    [“statement”]=>
    string(43) “SELECT * FROM toto_ WHERE $p IN interests”
    ["$p"]=>
    string(16) “African Swallows”
    }
    [“adhoc”]=>
    bool(true)
    [“crossBucket”]=>
    bool(false)
    }

    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)

phpinfo():

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
ENV ALPINE_MIRROR "http://dl-cdn.alpinelinux.org/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.php.net &&\
    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  http://nl.alpinelinux.org/alpine/edge/community &&\
    pecl install --alldeps couchbase-2.6.0 &&\
    echo 'extension=igbinary.so' >> /usr/local/etc/php/conf.d/igbinary.ini &&\
    echo 'extension=couchbase.so' >> /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
EXPOSE 9000
CMD ["php-fpm"]

My Docker container runs under Ubuntu 18.04.2 LTS.