Hi guys,

I posted this to the libmemcached mailing list a while ago and didn't
get a response, but this list is a lot more active so I'm hoping
someone here will have answers for me. :)

I've taken some time to work on porting our code from using the PHP
PECL memcache extension to using the PECL memcached extension so we
can take advantage of all the advanced functionality that libmemcached
has to offer, but I'm running into some issues using the binary
protocol.

Here is my code:

<?php
$servers = array(array('localhost', '11211'));
$m = new Memcached();
$m->addServers($servers);
$m->setOption(Memcached::OPT_DISTRIBUTION,
Memcached::DISTRIBUTION_CONSISTENT);
$m->setOption(Memcached::OPT_CONNECT_TIMEOUT, 500);
$m->setOption(Memcached::OPT_SEND_TIMEOUT, 500);
$m->setOption(Memcached::OPT_RECV_TIMEOUT, 500);
$m->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$m->setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1);


$m->set('foo', '100');
var_dump($m->get('foo'));
?>

If I run this, the script never finishes executing.
If I change OPT_BINARY_PROTOCOL to false, it instantly returns with
the results.
So the two major issues are that it doesn't seem to be obeying my
timeout settings, and of course the binary protocol doesn't seem to be
working. Is there something I need to change on the server end to
support binary protocol? I'm running version 1.4.4 of memcached and
have the latest libmemcached and PECL memcached extensions installed.

Thanks!

Jay

Reply via email to