# Unable to log errors \[Resolved\]

**URL:** <https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764>\
**Category:** PHP Client Library\
**Created:** [September 5, 2015, 9:11pm UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764 "2015-09-05T21:11:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kicker](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@Kicker](https://discuss.aerospike.com/u/Kicker)\
**Post date:** [September 5, 2015, 9:11pm UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764/1 "2015-09-05T21:11:39Z")

</div>

Hello,

I have a save function that return an error, but I can’t see which one because it always prints this:

> 

Fatal error: Cannot access private property Aerospike::$errorno in /_some dirs_/DBClass.php on line 162

Which looks like:

> static public function set($ns, $set, $key\_name, $bins) { $client = self::getDb();

```
    $key = $client->initKey($ns, $set, $key_name);

    $status = $client->put($key, $bins);
    if ($status != Aerospike::OK) {
        LogClass::log("Error writing {$ns}, {$set}, {$key_name}, $client->errorno(), $client->error()");
    }
    return $status;
}

```

I know that $status value is ERR\_BIN\_NAME, that’s all I know.

$ns = “users”

$set = “users”

$key\_name = _a string of about 20 characters_

Thanks in advance

---

<div class="post-metadata">

**Author:** ![rbotzer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/rbotzer/32/2114_2.png) [@rbotzer](https://discuss.aerospike.com/u/rbotzer)\
**Post date:** [September 5, 2015, 10:26pm UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764/2 "2015-09-05T22:26:41Z")

</div>

I’m not sure what line 162 corresponds to, but both error() and errorno() are public methods of the Aerospike class.

Take a look at the [error handling and logging methods](https://github.com/aerospike/aerospike-client-php/blob/master/doc/apiref_error.md) in the doc. I’m not sure where the problem is, yet. Error handling seems to be working fine.

---

<div class="post-metadata">

**Author:** ![Kicker](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@Kicker](https://discuss.aerospike.com/u/Kicker)\
**Post date:** [September 5, 2015, 10:29pm UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764/3 "2015-09-05T22:29:16Z")

</div>

Line 162 corresponds to this:

> LogClass::log(“Error writing {$ns}, {$set}, {$key\_name}, $client-\>errorno(), $client-\>error()”);

$client is an instance of Aerospike. If it’s public, then why does my PHP script crashes, telling me that errorno is private?

Also, I don’t understand why there is an error in the first place… Here’s a var\_dump of the bins I’m trying to put in:

> array(11) { [“diamonds”]=\> int(30) [“lives”]=\> float(5) [“life\_time”]=\> float(1441493823) [“last\_reward\_time”]=\> int(1441493823) [“save\_time”]=\> float(1441493823) [“version”]=\> int(0) [“current\_level”]=\> int(1) [“tutorial\_mode”]=\> int(1) [“creation\_time”]=\> int(1441493823) [“prompt\_like”]=\> bool(true) [“boosters”]=\> array(3) { [0]=\> int(0) [1]=\> int(0) [2]=\> int(0) } }

---

<div class="post-metadata">

**Author:** ![Kicker](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@Kicker](https://discuss.aerospike.com/u/Kicker)\
**Post date:** [September 5, 2015, 11:07pm UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764/5 "2015-09-05T23:07:14Z")

</div>

Ok, nevermind. It was a PHP error. Putting $client-\>errorno() inside the string, it was trying to access $client-\>errorno, which is indeed a protected attribute.

The error is “Bin name longer than 14 chars”. Indeed, I use a Facebook ID as a key, and Facebook IDs have 16 characters, and sometimes more.

This is a real problem, because this id is the only identifier I have for my users… and I can’t truncate it without risking duplicates…

What can I do to solve this? Is there a way to change this limit?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![rbotzer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/rbotzer/32/2114_2.png) [@rbotzer](https://discuss.aerospike.com/u/rbotzer)\
**Post date:** [September 5, 2015, 11:42pm UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764/6 "2015-09-05T23:42:11Z")

</div>

I’m not sure why you’d use the Facebook ID as the key, seems like it should be the value, and the bin name something like ‘fbid’, no? It doesn’t make sense to me, I wonder if you could explain the thinking behind it.

Be aware that there’s a limit of 32k unique bin names in a namespace. See the [FAQ](https://www.aerospike.com/docs/guide/FAQ.html).

---

<div class="post-metadata">

**Author:** ![Kicker](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@Kicker](https://discuss.aerospike.com/u/Kicker)\
**Post date:** [September 6, 2015, 12:14am UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764/7 "2015-09-06T00:14:36Z")

</div>

The value is actually the user’s data…

It would be like:

> ```
> "123456789123456789" -> {"name":"kevin", "age":15}
> "123456789123456790" -> {"name":"michael", "age":24}
> ...
> "123456789123456889" -> {"name":"john", "age":42}
> 
> ```

I took a look at the FAQ about limits… I’m not sure how I am going to scale this to potential millions of users… I guess I can just split the key into several parts, like this:

> ```
> (12345678912345)(688)(9)
> (bin name)(set)(namespace)
> 
> ```

Then I would have 14 character key names in each set, 1000 sets per namespace, and 10 namespaces… The total number of users would be limited to 327 670 000 users, which is more than enough.

But it’s a very fragile structure… what if Facebook changes their ids for longer ones? (it wouldn’t be the first time)

---

<div class="post-metadata">

**Author:** ![rbotzer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/rbotzer/32/2114_2.png) [@rbotzer](https://discuss.aerospike.com/u/rbotzer)\
**Post date:** [September 6, 2015, 5:46am UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764/8 "2015-09-06T05:46:08Z")

</div>

Your example makes it look like those FB IDs should be the primary key for a set named ‘facebook’ (or something of that sort). The primary key can be of any length since it actually gets hashed into a 20 byte digest used by the client and server nodes to locate the record.

---

<div class="post-metadata">

**Author:** ![Kicker](https://avatars.discourse-cdn.com/v4/letter/k/7c8e57/32.png) [@Kicker](https://discuss.aerospike.com/u/Kicker)\
**Post date:** [September 6, 2015, 9:18am UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764/9 "2015-09-06T09:18:43Z")

</div>

I thought the bin name and the primary was the same thing… I’m confused. If I take the example from the Quick Guide:

> ```
> $key = $db->initKey("infosphere", "characters", 3);
> $bins = ["name" => "Bender", "Occupation" => "Bender", "age" => 1055];
> // store the key data with the record, rather than just its digest
> $option = [Aerospike::OPT_POLICY_KEY => Aerospike::POLICY_KEY_SEND];
> $db->put($key, $bins, 0, $option);
> 
> ```

I see a namespace, a set, a primary key name for the bins, and bins containing keys-\>values. I looked into the API reference, and the $pk parameter for the initKey method is where I put my Facebook IDs. So if you say thay $pk can have any length… it shouldn’t raise an error…

Edit: nevermind… “last\_reward\_time” has 16 characters… that’s probably what’s raising the error :facepalm:

---

<div class="post-metadata">

**Author:** ![rbotzer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/rbotzer/32/2114_2.png) [@rbotzer](https://discuss.aerospike.com/u/rbotzer)\
**Post date:** [September 6, 2015, 3:16pm UTC](https://discuss.aerospike.com/t/unable-to-log-errors-resolved/1764/10 "2015-09-06T15:16:03Z")

</div>

Ha. No problem. Take out those underscores.
