我在ubuntu上安装了couchbase:
$ php -i | grep couchbase
Additional .ini files parsed => /etc/php5/cli/conf.d/couchbase.ini,
couchbase
couchbase support => enabled
libcouchbase version => 2.0.5
couchbase.compression_factor => 1.3 => 1.3
couchbase.compression_threshold => 2000 => 2000
couchbase.compressor => none => none
couchbase.config_cache => no value => no value
couchbase.durability_default_poll_interval => 100000 => 100000
couchbase.durability_default_timeout => 40000000 => 40000000
couchbase.instance.persistent => On => On
couchbase.restflush => On => On
couchbase.serializer => php => php
couchbase.view_timeout => 75 => 75
我也这样做了:
$ locate libevent.so
/opt/couchbase/lib/libevent.so
$ export DYLD_LIBRARY_PATH=/opt/couchbase/lib
$ echo $DYLD_LIBRARY_PATH
/opt/couchbase/lib
所以现在我尝试运行以下脚本:
#!/usr/bin/php
<?php
$cb = new Couchbase("127.0.0.1:8091", "", "", "default");
$cb->set("a", 101);
var_dump($cb->get("a"));
?>
但我收到以下错误:
PHP Fatal error: Uncaught exception 'CouchbaseLibcouchbaseException' with message 'Failed to create libcouchbase instance' in /tmp/test.php:3
我应该如何解决这个问题?
答案 0 :(得分:3)
我接受了eddie的建议并重新使用apt
。现在一切正常:
sudo wget -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list
wget -O- http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install libcouchbase{2,-dev,-dbg}