Aerospike returns error [4] AEROSPIKE_ERR_REQUEST_INVALID for PHPClient


#1

I have a simple script with PHPClient.

But unfortunately, it returns an error: [4] AEROSPIKE_ERR_REQUEST_INVALID.

I checked the doc, and I got this msg: Request protocol invalid, or invalid protocol field. that I still can’t know why.

Anyone help? Thanks

###Here is my code:

<?php
$config = [
    "hosts" => [
        ["addr" => "127.0.0.1", "port" => 3000]
    ]
];

$db = new Aerospike($config);

if (!$db->isConnected()) {
  echo "Failed to connect to the Aerospike server [{$db->errorno()}]: {$db->error()}\n";
  exit(1);
}
$i=50000;
while(true){
        $key = $db->initKey("test", "Test$i", 3);
        $bins=["name"=>"Test $i"];

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

        if ($status == Aerospike::OK) {
            echo "Record written. ns=test, key=Test$i, bin=name, value='Test $i'\n";
            $i++;
            sleep(2);
        } else {
            echo "[{$db->errorno()}] ".$db->error().PHP_EOL;
            exit;
        }
}

#2

Additional info: the cli command works as expected.


#3

My bad. I clear all data, it works fine.

Maybe I have some invalid data.