2015-09-26 103 views
1

到的Neo4j我在Neo4j的新的,我嘗試使用neoclient GitHub的 說明如下。我用composer和neo4j 2.2.5安裝了neoclient。 現在我想用PHP使用它。當我嘗試設置了以下連接:無法連接通過

<?php 
require_once 'vendor/autoload.php'; 
use Neoxygen\NeoClient\ClientBuilder; 
$client = ClientBuilder::create() 
->addConnection('default', 'http', 'localhost', 7474) 
->build(); 


$query = 'CREATE (user:User {name:"Kenneth"}) RETURN user'; 
$result = $client->sendCypherQuery($query)->getResult(); 
?> 

我得到以下錯誤:

Fatal error: Uncaught exception 'Neoxygen\NeoClient\Exception\HttpException' with message 'Error on Connection "default" with message "Client error response [url] http://localhost:7474/db/data/transaction/commit [status code] 401 [reason phrase] Unauthorized"' in C:\wamp\www\fantapappa\vendor\neoxygen\neoclient\src\EventListener\HttpRequestEventSubscriber.php on line 65

Neoxygen\NeoClient\Exception\HttpException: Error on Connection "default" with message "Client error response [url] http://localhost:7474/db/data/transaction/commit [status code] 401 [reason phrase] Unauthorized" in C:\wamp\www\fantapappa\vendor\neoxygen\neoclient\src\EventListener\HttpRequestEventSubscriber.php on line 65

有人可以幫助我嗎?我錯了?

+0

401禁用(發展)AUTH肯定是因爲你沒有提供一個密碼的問題,請接受邁克爾的答案,如果這是解決 –

+0

現在我不能謝謝,但我認爲這是問題。只要我接受邁克爾的回答。謝謝! –

回答

3

你必須要麼提供用戶名(neo4j)和密碼(你有在Neo4j的瀏覽器的前期設置)。

您可以在conf/neo4j-server.properties

dbms.security.auth_enabled=false 
+0

thanls,我不在家,我不能籤,我會盡快 –

+0

我解決我的問題只設置dbms.security.auth_enabled =假做。我無法訪問我的usr和psw。 –

+0

請將您的問題與您使用的完整代碼進行適配,並確保neoclient支持neo4j的內置認證。 –