我们只是将我们的第一个 Neo4j 2.1 应用程序安装到 Jelastic 服务器环境中,并且无法连接到工作的数据库。简单的程序(来自neo4jphp 中的答案:无法实例化抽象类 Everyman\Neo4j\Transport)是这样的:
require('vendor/autoload.php');
use Everyman\Neo4j\Client;
$client = new Client($Server_ip_address, 8080);
print_r($client->getServerInfo());
最后一行给出错误 401 Unauthorized:
'无法检索服务器信息 [401]:\nHeaders: Array
(
[WWW-Authenticate] => Basic realm="neo4j graphdb"
[Content-Type] => text/html; charset=ISO-8859-1
[Cache- Control] => must-revalidate,no-cache,no-store
[Content-Length] => 0
[Server] => Jetty(9.0.5.v20130815)
)正文
:Array
(
)
'。
我应该在我的 Apache 2.2 环境中的某处配置 user_id/password,还是缺少其他东西?
毕竟谢谢!工作版本是这样的:
require('vendor/autoload.php');
use Everyman\Neo4j\Client;
$client = new Everyman\Neo4j\Client($host, $port);
$client->getTransport()
->setAuth($username, $password);
print_r($client->getServerInfo());
如果您没有受信任的环境,也应该使用“->useHttps()”。