您好,我试图在 ubuntu 12.04 上将 php 5.3 升级到 5.4,但我确实在使 couchbase 和 php 工作时遇到了一些麻烦,所以我决定删除 5.4 并重新安装 5.3。之后,我尝试建立一个简单的沙发底座连接,但出现此错误:
Fatal error: Uncaught exception 'CouchbaseLibcouchbaseException' with message 'Failed to create libcouchbase instance' in /var/www/taxi.localhost/couchbaseManager.php:8 Stack trace: #0 /var/www/taxi.localhost/couchbaseManager.php(8): Couchbase->__construct('127.0.0.1:8091', '', '', 'default') #1 /var/www/taxi.localhost/index.php(11): couchbaseManager->__construct() #2 {main} thrown in /var/www/taxi.localhost/couchbaseManager.php on line 8
这是couchbaseManager.php的代码:
<?php
class couchbaseManager{
private $cb;
public function __construct() {
//include 'dbConnectionSettings.php';
$this->cb = new Couchbase("127.0.0.1:8091", "", "", "default");
}
public function __destruct() {
return $this->cb;
}
public function get($key) {
return $this->cb->get($key);
}
public function set($key, $value) {
$this->cb->set($key, $value);
}
}
?>
我已经完全按照他们在官方网站上所说的做了......
1) sudo wget -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list
2) sudo apt-get update
3) sudo apt-get install libcouchbase2 libcouchbase-dev
接着:
4) sudo apt-get install php-pear
5) sudo apt-get install build-essential
6) sudo pecl install couchbase
7) extension=couchbase.so (in etc/php5/apache2/php.ini)
8) sudo service apache2 restart
在我尝试迁移到 php 5.4 之前,一切都很好,但现在我无法弄清楚问题出在哪里。
PS php信息:
PHP 5.3.10-1ubuntu3.7 with Suhosin-Patch (cli) (built: Jul 15 2013 18:05:44)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies