【问题标题】:Graphstory and Neo4jphpGraphstory 和 Neo4jphp
【发布时间】:2015-03-06 11:16:57
【问题描述】:

我已经按照文档通过这个简单的步骤成功地将 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 如下

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

【问题讨论】:

    标签: neo4j neo4jphp


    【解决方案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

    【讨论】:

      【解决方案2】:

      我是 Graph Story 的 CTO/首席开发人员。很抱歉听到您遇到麻烦。实际上,我刚刚查看了您的实例,从服务器端看起来一切正常。

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-04-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多