AllisonC
AllisonC

Reputation: 3100

Memcache getVersion is not the same as phpinfo

Here is the code:

$memcache = new Memcache();
$memcache->addServer('127.0.0.1', 11211);
$result = $memcache->get("TEST");
if ($result)
{
  echo $result;
}
else
{
  echo "TEST key not found, adding key";
  if (!$memcache->set("TEST", "Memcache key found. Memcache is working."))
  {
    echo "could not set memcache key";
  }
}
echo "Memcache version: ";
var_dump($memcache->getVersion());

This part results in:

1.2.6

However, the phpinfo says it is 2.2.5: enter image description here

When I run the command memcached -h directly on the server, I get 1.2.6

Why is there a difference in version number?

Upvotes: 0

Views: 190

Answers (1)

Zoli Szabó
Zoli Szabó

Reputation: 4544

$memcache->getVersion() returns the version of the server (according to the documentation), while phpinfo() shows the version of the memcache PHP extension.

Upvotes: 2

Related Questions