Graphstory和Neo4jphp

时间:2015-03-06 11:16:58

标签: neo4j neo4jphp

我已经成功地将neo4jphp库与graphenedb一起使用了这个简单的步骤(考虑到 graphenedb 不需要https)

require('vendor/autoload.php'); // or your custom autoloader
// Connecting to a different port or host
$client = new Everyman\Neo4j\Client(url, port);
// Connecting using HTTP and Basic Auth
$client->getTransport()
->setAuth('username', 'password');
// Test connection to server
print_r($client->getServerInfo());

然而,当尝试连接到 graphstory 实例时(当然,如果我从浏览器调用其余的api,neo4j控制台工作正常等,它们都能正常工作),这需要https,如下所示< / p>

require('vendor/autoload.php'); // or your custom autoloader
// Connecting to a different port or host
$client = new Everyman\Neo4j\Client(url, port);
// Connecting using HTTPS and Basic Auth
$client->getTransport()
->useHttps()
->setAuth('username', 'password');
// Test connection to server
print_r($client->getServerInfo());

我收到以下错误。它们应该是相同的,我无法理解。

Fatal error: Uncaught exception 'Everyman\Neo4j\Exception' with message 'Can't open connection to https://neo-54f500bf2cc7e-364459c455.do-stories.graphstory.com:7473/db/data/' in /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Transport/Curl.php:91 
Stack trace: 
#0 /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Transport.php(95): Everyman\Neo4j\Transport\Curl->makeRequest('GET', '/', NULL) 
#1 /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Command.php(64): Everyman\Neo4j\Transport->get('/', NULL) 
#2 /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Client.php(828): Everyman\Neo4j\Command->execute() 
#3 /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Client.php(464): Everyman\Neo4j\Client->runCommand(Object(Everyman\Neo4j\Command\GetServerInfo)) 
#4 /Applications/XAMPP/xamppfiles/htdocs/graphene/story.php(20): Every in /Applications/XAMPP/xamppfiles/htdocs/graphene/vendor/everyman/neo4jphp/lib/Everyman/Neo4j/Transport/Curl.php on line 91

2 个答案:

答案 0 :(得分:1)

在我看来,neo4jphp没有在cURL请求中配置TLS部分。

我通过从http://curl.haxx.se/docs/caextract.html(ca_bundle.crt)下载证书包并将以下行添加到Everyman \ Neo4j \ Transport \ Curl.php,函数makeRequest:

来修复它
$options[CURLOPT_CAINFO] = "your/path/to/ca-bundle.crt";

我在GitHub上为此创建了一个问题:https://github.com/jadell/neo4jphp/issues/171

答案 1 :(得分:0)

我是Graph Story的首席技术官/首席开发人员。很抱歉听到你有麻烦。我实际上只是看了一下你的实例,从服务器端看来似乎没问题。

如果没有其他信息,很难说您的示例连接代码是否存在问题。考虑到您过去曾使用相同的库连接到GrapheneDB,我认为示例代码中的错误可能很少。

根据您的实例的当前状态以及Neo4jPHP抛出的异常,我的猜测是您的网络上可能会阻止端口7473。您可以通过本地技术支持或切换到您知道端口7473已打开并尝试再次连接的网络来确认。