1

I'm new in neo4j and i'm trying to use neoclient following the github instructions. I have installed neoclient with composer and neo4j 2.2.5. Now i'm trying to use it with php. When i try to set up the connection with following:

<?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();
?>

I get the following error:

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

and

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

can someone help me? where i'm wrong?

Pierpaolo Croce
  • 57
  • 2
  • 14

1 Answers1

3

You have to either provide a username (neo4j) and password (that you have to set in Neo4j-Browser upfront).

You you can disable auth (for development) in conf/neo4j-server.properties

dbms.security.auth_enabled=false
Michael Hunger
  • 41,339
  • 3
  • 57
  • 80