Php sdk - Fatal error: Class 'Couchbase' not found in

I am receiving this error when running the test app:

Fatal error: Class ‘Couchbase’ not found in

Test app code:

<?php $cb = new Couchbase("127.0.0.1:8091"); // uses the default bucket $cb->set("a", 1); var_dump($cb->get("a")); ?>

During the PHP sdk install I am seeing this error:

sudo pecl install couchbase

ERROR: `/root/tmp/pear/couchbase/configure’ failed

The directory /root/tmp/pear/couchbase does not exist.


I am able to access the CouchBase console via port 8091


root@host [/tmp]# rpm -qa | grep libcouchbase
libcouchbase2-libevent-2.4.2-1.el6.x86_64
libcouchbase2-core-2.4.2-1.el6.x86_64
libcouchbase-devel-2.4.2-1.el6.x86_64


php -i output:

couchbase

Version => 2.0.0

php.ini contains:

extension=couchbase.so
extension=json.so

OS:
root@host [/tmp]# cat /etc/redhat-release
CentOS release 6.5 (Final)

Hello.

You should try: https://github.com/couchbaselabs/php-couchbase

Hi,

I have the same issue, I get:

FastCGI: server “/usr/lib/cgi-bin/php5-fcgi” stderr: PHP message: PHP Fatal error: Class ‘Couchbase’ not found in /my/script

The .so is loaded but I don’t get any information more than:

couchbase
Version 2.0.0

I’m on Ubuntu 14.04 and did all steps that are required.

Any help on this ?

@YamakasY: you should uninstall the 2.0.0 version and revert to 1.2.2

pecl uninstall couchbase

pecl install couchbase-1.2.2

Hi!

Thanks, I already thought so, but wan’t able to figure out how to get there.

Can I copy that .so over to all other servers ?

@YamakasY: yes, but be sure to include it in the right php extensions location (php -i | grep extensions), or to add the full path to the php.ini configuration file

Yes I know, thanks!

I also still need these I suppose ? libcouchbase2-libevent libcouchbase-dev

Hey Guys,

Looks like you are trying to use the 1.x API with the 2.x SDK! Take a look at the following URLs for further
information.

About the 2.x SDK’s:
http://blog.couchbase.com/php-sdk-200-developer-preview
http://blog.couchbase.com/php-sdk-200-developer-preview-2
http://blog.couchbase.com/php-sdk-200-beta-2
http://blog.couchbase.com/php-sdk-200-beta

2.0 Developer Guide and API Reference:
http://docs.couchbase.com/prebuilt/php-sdk-2.0/topics/overview.html

Check out http://docs.couchbase.com/ for always up-to-date documentation information.

Cheers, Brett

@YamakasY: yes, you do not have to install ibcouchbase2-libevent libcouchbase-dev. But you have to decide if you want to switch to the new version of the SDK. In that case you have to install it and change your code in order to use the new API as brett19 suggested: http://blog.couchbase.com/php-sdk-200-developer-preview

Hi Brett,

Thank you for directing me to the 2.0 API. The current getting started page http://www.couchbase.com/communities/php/getting-started directs you to download the 2.0 SDK and the sample “try it out” section still refers to API 1.x

I have now followed the instructions on the beersample app and am getting the following error:

CouchbaseException: method_not_allowed: Only GET,POST,HEAD allowed

  1. in CouchbaseNative line 1186
  2. at CouchbaseBucket->_view(object(_CouchbaseDefaultViewQuery)) in CouchbaseNative line 1240
  3. at CouchbaseBucket->query(object(_CouchbaseDefaultViewQuery)) in /home/trendcan/public_html/beersample-php/index.php line 37
  4. at {closure}()
  5. at call_user_func_array(object(Closure), array()) in /home/trendcan/public_html/beersample-php/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 117
  6. at HttpKernel->handleRaw(object(Request), '1') in /home/trendcan/public_html/beersample-php/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php line 61
  7. at HttpKernel->handle(object(Request), '1', true) in /home/trendcan/public_html/beersample-php/vendor/silex/silex/src/Silex/Application.php line 504
  8. at Application->handle(object(Request)) in /home/trendcan/public_html/beersample-php/vendor/silex/silex/src/Silex/Application.php line 481
  9. at Application->run() in /home/trendcan/public_html/beersample-php/index.php line 80

Problem solved.
Reverted to SDK 1.2.2.

pecl uninstall couchbase
pecl insall couchbase-1.2.2

I really wish that was listed better in the getting started section, definitely feel like I just banged my head against a wall for a week.

Big thanks to Kirk!

Hey sultrain,
Please check out the new documentation available at: http://docs.couchbase.com/developer/php-2.0/php-intro.html.
Cheers, Brett