Aerospike construct (Array, false) error

Hi,

We have configured aerospike on our ubuntu server with below php code, whenever we are opening the url or manually accessing the php file. we are getting the below error.

PHP Fatal error: Uncaught Exception: Failed to connect in path/aerospike/examples/query_examples/simple.php:36\nStack trace:\n#0 path/aerospike/examples/query_examples/simple.php(36): Aerospike->__construct(Array, false)\n#1 {main}\n thrown in path/aerospike/examples/query_examples/simple.php on line 36

code :

<?php
$config = [
    "hosts" => [
        ["addr" => "public ip", "port" => 3000]
    ]
];
$db = new Aerospike($config);
exit;
if (!$db->isConnected()) {
  echo "Failed to connect to the Aerospike server [{$db->errorno()}]: {$db->error()}\n";
  exit(1);
}

$key = $db->initKey("test", "characters", 3);
$bins = [
  "Occupation" => ["Bender", "Criminal", "Iron Chef"],
  "Alma Mater" => "Bending State University"];

$status=$db->put($key,$bins);

if ($status == Aerospike::OK) {
    echo "Record written.\n";
} else {
    echo "[{$db->errorno()}] ".$db->error().PHP_EOL;
}

Please help us on this to resolve this issue.

– Anwar

Can you share which version of PHP, the PHP library, and Aerospike Server you are using?

Are you able to connect to the server using AQL?