Problem using CouchBase PHP SDK from Apache (shell is working fine)
Tue, 11/06/2012 - 00:35
I installed couchbase on Centos 6.3 x86 with the PHP SDK. I used the php demopage below to test the installation.
<?php $cb = new Couchbase("localhost:8091"); $cb->set("a", 1); var_dump($cb->get("a")); ?>
Everything is working fine when calling the php script from shell.
shell> php /var/www/html/couchbasetest.php int(1)
But running under apache it will give me the following error.
Warning: Couchbase::__construct(): Failed to connect libcouchbase to server: Connection failure in /var/www/html/couchbasetest.php on line 7 Warning: Couchbase::set(): unintilized couchbase in /var/www/html/couchbasetest.php on line 8 Warning: Couchbase::get(): unintilized couchbase in /var/www/html/couchbasetest.php on line 9 bool(false)
I tried to solve the issue by giving a username, password and bucketname in code but that didn't help me either.
How can I solve this problem? It seems like a kind of security issue. I am not a Linux geek so that could be the problem too ;-)
Wed, 11/07/2012 - 23:30
The extension seems to be fine for PHP:
shell> php -i
Gives me:
couchbase couchbase support => enabled version => 1.0.5 json support => yes fastlz support => no zlib support => yes Directive => Local Value => Master Value couchbase.compression_factor => 1.3 => 1.3 couchbase.compression_threshold => 2000 => 2000 couchbase.compressor => none => none couchbase.serializer => php => php
Running phpinfo(); within a php file and loading it from an external browser will give the same results.
Wed, 01/16/2013 - 06:12
I have the same problem on CentOS 6.2
You probably didn't properly set up your extension properly. Make sure that you have added the following in your php.ini file.
extension=/path/to/couchbase.so
The look at the output of "php -i" and make sure your extension was loaded properly.