dongshao9106 2018-01-27 22:47 采纳率: 100%
浏览 62
已采纳

memcache有错误

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("127.0.0.1", 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?

  • 写回答

1条回答 默认 最新

  • dongsimu4422 2018-01-27 22:51
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化