Help setting up PHP to connect to Couchbase
Hi,
I am trying to evaluate Couchbase for our dev needs.
Environment: Ubuntu 10.4 64 bit
Couchbase Server 1.8 Community
I have Couchbase server successfully running, and now I want to do a simple test from PHP. I created a temp.php file for testing, however it gives an error.
Source is:
<?php
// adjust these parameters to match your installation
$cb = new Couchbase("", "Administrator", "", "default");
$cb->set("a", 1);
var_dump($cb->get("a"));
?>
Response: Fatal error: Class 'Couchbase' not found in /var/www/vhosts//temp.php on line 3
I added couchbase.so to the PHP library, but then the log said it needed libcouchbase.so.1, and so I found and added that. It then said it needed libvbucket.so.1, so I added that. Now it is giving me the error in the log file of:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/couchbase.so' - libcouchbase.so.1: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/libcouchbase.so.1' - libvbucket.so.1: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'libvbucket.so.1' in Unknown on line 0
Are there some simple steps that I am missing to configure Couchbase SDK with PHP5?
Any help would be really appreciated.
Thanks!
Hi Jeremy, pslade,
can you try the latest PHP SDK: http://www.couchbase.com/develop/php/current and report if you still get the problem?
Cheers
Jan
--
Hey Jan, thanks for the reply.
As it is, I'm on 11.10 and it was getting the C client libs in that couldn't be done in the time I had.
So I set up a ubuntu 10.04 LTS 32 bit via virtualbox.org, and it worked fine as per instructions, bridged the network and carried on development and learning via that route.
I was using the latest PHP client in both cases.
Hey Jeremy,
sorry if this sounds dumb, but are you saying this is solved for you now or do you still have that error?
The original error message suggests that you need to install libvbucket that you said you had.
Cheers
Jan
--
User error all the way, and a bit of RTFM .....
I was indeed missing libvbucket.
I can confirm I have it set up and running now on :
- ubuntu server 10.04 LTS 32bit
- kubuntu 11.10 desktop 64bit
With :
- couchbase 1.8.0
- PHP 5.3.x
- apache2
Cheers for the follow up.
Good news Jeremy! :)
Any luck ?
I'm getting much the same.