I'm new to Neo4j. I'm using Neo4jPHP with WAMP to try to test my connection to my Neo4j Database with the following code:
require('vendor/autoload.php');
$client = new Everyman\Neo4j\Client('localhost', 7474);
print_r($client->getServerInfo());
But when I run the code above, I get these errors:
Fatal error: Uncaught exception 'Everyman\Neo4j\Exception' with message ' in C:\wamp\www\vendor\everyman\neo4jphp\lib\Everyman\Neo4j\Command.php on line 116
Everyman\Neo4j\Exception: Unable to retrieve server info [401]: Headers: Array ( [Date] => Tue, 08 Sep 2015 21:48:28 GMT [Content-Type] => application/json; charset=UTF-8 [WWW-Authenticate] => None [Content-Length] => 144 [Server] => Jetty(9.2.z-SNAPSHOT) ) Body: Array ( [errors] => Array ( [0] => Array ( [message] => No authorization header supplied. [code] => Neo.ClientError.Security.AuthorizationFailed ) ) ) in C:\wamp\www\vendor\everyman\neo4jphp\lib\Everyman\Neo4j\Command.php on line 116
As I said, I'm new to Neo4j, so I don't know what I could be doing wrong. Neo4j is running and I've been able to test it by connecting to localhost:7474
Any help is appreciated!
I think the 401 means that Neo4j is requiring authentication. Looking at neo4jphp I'm not sure that it supports Neo4j's on-by-default authentication which was introduced in Neo4j 2.2.0.
You could check out NeoClient. From the README the code to connect with a username and password would be something like:
If you really want to use neo4jphp you could disable authentication (of course not recommended unless you've otherwise secured the database). There is also this issue on the repo which might be helpful:
https://github.com/jadell/neo4jphp/issues/165