Class 'CouchbaseCluster' not found in apache's error log

Hello people I’m trying to install The Couchbase PHP SDK but for some reason PHP not found the class.

I wrote extension=json.so and extension=json.so in PHP ini.

Pecl info dont shows me nothing about couchbase and php -m shows me that the extension is loaded but in the phpinfo there is nothing about couchbase .

I’m using PHP7 and Ubuntu 16

I dont know what happend, can you help me pls? Thank you

Could you post full log of pecl install couchbase here?

I can’t too long, do you want something specific?

this forum allows attachments, I just like to see how the configure script worked, build output and the pecl instructions in the end.

Also post php --ini.

Also turn on error_reporting=E_ALL and display_startup_errors=1 and try to run your script, and post output here.

Sorry, I can’t upload attachments. I’m a new user.

PHP --INI

PHP Warning: Module ‘json’ already loaded in Unknown on line 0
[cb,WARN] (pcbc/ext L:393) igbinary serializer is not found
Configuration File (php.ini) Path: /etc/php/7.1/cli
Loaded Configuration File: /etc/php/7.1/cli/php.ini
Scan for additional .ini files in: /etc/php/7.1/cli/conf.d
Additional .ini files parsed: /etc/php/7.1/cli/conf.d/10-opcache.ini,
/etc/php/7.1/cli/conf.d/10-pdo.ini, /etc/php/7.1/cli/conf.d/15-xml.ini,
/etc/php/7.1/cli/conf.d/20-calendar.ini, /etc/php/7.1/cli/conf.d/20-ctype.ini,
/etc/php/7.1/cli/conf.d/20-dom.ini, /etc/php/7.1/cli/conf.d/20-exif.ini,
/etc/php/7.1/cli/conf.d/20-fileinfo.ini, /etc/php/7.1/cli/conf.d/20-ftp.ini,
/etc/php/7.1/cli/conf.d/20-gettext.ini, /etc/php/7.1/cli/conf.d/20-iconv.ini,
/etc/php/7.1/cli/conf.d/20-json.ini, /etc/php/7.1/cli/conf.d/20-phar.ini,
/etc/php/7.1/cli/conf.d/20-posix.ini, /etc/php/7.1/cli/conf.d/20-readline.ini,
/etc/php/7.1/cli/conf.d/20-shmop.ini, /etc/php/7.1/cli/conf.d/20-simplexml.ini,
/etc/php/7.1/cli/conf.d/20-sockets.ini, /etc/php/7.1/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.1/cli/conf.d/20-sysvsem.ini, /etc/php/7.1/cli/conf.d/20-sysvshm.ini,
/etc/php/7.1/cli/conf.d/20-tokenizer.ini, /etc/php/7.1/cli/conf.d/20-wddx.ini,
/etc/php/7.1/cli/conf.d/20-xmlreader.ini, /etc/php/7.1/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.1/cli/conf.d/20-xsl.ini

ERROR

Fatal error: Uncaught Error: Class ‘CouchbaseCluster’ not found in /var/www/html/index.php:8 Stack trace: #0 {main} thrown in /var/www/html/index.php on line 8

Does it work in CLI mode with simple script like this?

<?php
$cluster = new CouchbaseCluster("couchbase://localhost");

Could you post your script?

<?php $bucketName = "default"; // Connect to Couchbase Server $cluster = new CouchbaseCluster("couchbase://127.0.0.1"); $bucket = $cluster->openBucket($bucketName); Is the same script as the script on web page.

Does it work in CLI mode?

Oh wow, yes, it works in CLI mode

I guess your apache configured to use different php.injury, where couchbase is not loaded

For background, I’m running on Ubuntu 16.04 with PHP 7.0 right now.

I’m receiving a bit of the same error here; I no longer got the missing cluster class error but it still wouldn’t work correctly.

What I get when I try a simple cluster instance attempt is:

[cb,WARN] (pcbc/ext L:393) igbinary serializer is not found

Looks like in the install instructions, a user might have to do a

sudo pecl install igbinary

before

sudo pecl install couchbase

Just in case it helps to see the particular versions I’m using, my pecl list produces the following output:

Installed packages, channel pecl.php.net:
=========================================
Package   Version State
couchbase 2.3.0   stable
igbinary  2.0.1   stable
pcs       1.3.3   beta

Everything appears to be working correctly when using Couchbase 5.0 preview so far, though I haven’t gotten around to data retrieval from the DB itself.

It. Is just a warning. If you don’t use igbinaryour, you can ignore it.

What error do you see with data retrieval?

I created a simple PHP file that just created a CouchbaseCluster object and then print_r() what was returned. The problem is that the return value was empty as the only displayed information was that igbinary warning.

I installed igbinary and PHP told me I had to reinstall couchbase. Long story short, I had to remove couchbase via pecl, then I reinstalled 2.3.0. I figured it could help others save a little time. It was early this morning and my memory is a bit foggy, but I think it told me I had to rebuild couchbase. Being lazy, I use a browser to see phpinfo(). Before I manually added in igbinary, the line in couchbase for igbinary decoder was saying it was disabled. Now, after all this, it’s saying enabled.

Once I solved my igbinary warning, the returned value for the cluster object could be worked with.

Things are working well. Almost normal (being away from my Mac, my workflow suffers greatly).