Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

Class 'Couchbase' not found

1 reply [Last post]
  • Login or register to post comments
Fri, 04/06/2012 - 22:40
trosner-fitdilly
Offline
Joined: 04/06/2012
Groups: None

I've successfully setup Couchbase Server 1.8 on Ubuntu Linux 11.10 64bit. I've also added the PHP SDK and have added the following line to php.ini and restarted Apache

extension=/opt/couchbase/php-ext-couchbase/couchbase.so

I then installed the C Client Library

Once that was finished, I created the test PHP file as such:

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

The username and password are updated in the actual script, and only the default bucket exists. When I run the PHP script from the command line I receive the following error:

PHP Fatal error: Class 'Couchbase' not found in /var/www/couchbase.php on line 2

This same error is produced whether I include the couchbase.so extension in php.ini or not. Not sure why this is happening and any help would be much appreciated

Top
  • Login or register to post comments
Sat, 04/07/2012 - 09:33
trosner-fitdilly
Offline
Joined: 04/06/2012
Groups: None

I've managed to figure this one out and it had to do with PHP being picky about how the extension was loaded. After running "php -m" from the command line, I could see that the Couchbase extension wasn't being loaded...so here's what I did.

I opened up a phpinfo page to find PHP's default extension dir, and copied the couchbase.so file there.
Once that was done, I removed the "extension=/opt/couchbase/php-ext-couchbase/couchbase.so" file form php.ini
I then created a new couchbase.ini file in /etc/php5/conf.d and added the line "extension=couchbase.so"

Because the couchbase.so file was copied into PHP's default extension dir, a path wasn't required.

I restarted Apache, ran "php -m" and the extension showed as being loaded. I then ran the Couchbase PHP test script and received the following output:

int(1)

Success!

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker