cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Cannot connect from a PHP script: Desktop or Docker

Using the 'recommended' (from https://neo4j.com/developer/php/) graphaware/neo4j-php-client (which btw, appears to be no longer supported)

Tried 2 ways of doing this (i.e. servers)
1/ run desktop database
2/ run a docker instance using neo4j:latest (even tried neo4j:enterprise on the off chance)

PHP code:

$client = ClientBuilder::create()
            ->addConnection('default', 'bolt://neo4j:password@localhost:7687')
            ->build();

In both cases, I try to connect and get:

Handshake Exception. Unable to negotiate a version to use. Proposed versions were [1,0,0,0]

error

  • neo4j version: 4.0.6
  • desktop: 1.2.9

My preference is to use Docker as that fits the rest of my team's tool chain. Here is docker-compose config for reference:

neo4j:
    image: neo4j:latest
    restart: unless-stopped
    ports:
      # HTTP
      - "${LOCAL_LISTEN_ADDR}7474:7474"
      # BOLT
      - "${LOCAL_LISTEN_ADDR}7687:7687"
    volumes:
      - ${DEVILBOX_PATH}/neo4j/conf:/conf
      - ${DEVILBOX_PATH}/neo4j/data:/data
      - ${DEVILBOX_PATH}/neo4j/import:/import
      - ${DEVILBOX_PATH}/neo4j/logs:/logs
      - ${DEVILBOX_PATH}/neo4j/plugins:/plugins
    environment:
      # Raise memory limits
      - NEO4J_dbms_memory_pagecache_size=1G
      - NEO4J_dbms.memory.heap.initial_size=1G
      - NEO4J_dbms_memory_heap_max__size=1G

The docker container does fire up and I can browse to it with Chrome. Info gleaned for docker install from https://neo4j.com/developer/docker-run-neo4j/ and some blog posts.

So, it appears that whatever I do for a backend, I cannot connect to Neo4j. Unless I can get local dev working, then I'm going to have to look at alternative platforms for our graph db solution. Any ideas greatly appreciated.

5 REPLIES 5

Hi @chippyash,

I had the same issue. It seems that the community PHP drivers are not compatible with Neo4j v.4.0+.

A workaround is to use an older version of neo4j; I just tested that version 3.4.14 works with the drivers. Probably a later version, such as 3.5.15 might work too, but I have not tested it yet.

@paris.tsantarliotis. that is a shame. I guess neo4j is a dead end for PHP devs then because as I said, the php library is no longer supported. Oh well, off to Neptune and Gremlin or Sparkle we must go.

Either that or update your stack to include a language with official support.
There are many to choose from.

@webtic Not too helpful. Fancy chipping in for the retraining costs of 20 developers?

Moving forward, regardless the direction, involves training and learning.
If thats too costly you could also or stick with the current 3.5 series.
Or even start contributing to the community drivers 😉