2018-01-27 22:47



I am trying to get someone else's php and yii framework project working. I get this error trying to run one of their files:

Error: Call to undefined function memcache_get() in /var/yaamp/web/yaamp/core/functions/memcache.php:15

That particular section of code looks like this:

    public function get($key)
    return memcache_get($this->memcache, $key);

Your initial response may be that memcache isn't installed or not working correctly. But it is working. In my phpinfo() I see a standard entry for memcache. I also created a short php file pasted here that works just fine:

$mem_var = new Memcached();
$mem_var->addServer("", 11211);
$response = $mem_var->get("Bilbo");
if ($response) {
  echo $response;
  $mem_var->set("Bilbo", "Sent from memcache") or die("Dead");
} else {
  echo "Line 9";
  $mem_var->set("Bilbo", "Sent from memcache Line 10") or die("Dead");

I am new to memcache and not sure how to debug or fix this. This is ubuntu 16.03, php7 and lighttpd server Any ideas?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dongsimu4422 dongsimu4422 3年前

    Have you seen the difference between memcache and memcached? They are not the same, and if your script with new Memcached is working, but the one with memcache_get is not, then you have installed memcached, but not memcache

    点赞 评论 复制链接分享