【问题标题】:Php Class 'Memcache' not found找不到 PHP 类“Memcache”
【发布时间】:2017-05-24 21:22:38
【问题描述】:

我有一个纯 php 的项目,并且在某些部分有 $memcache = new Memcache; 我调试并且在开始这一行时出现致命错误 - 应用程序死亡我检查我的 php 信息我有

memcached

memcached    support    enabled
             Version    2.2.0
libmemcached version    1.0.18

我检查

ivan@ivan-PC:/usr/local/bin$ ps aux | grep memcached
ivan      2857  0.0  0.0  22804   960 pts/27   S+   13:44   0:00 grep --color=auto memcached
memcache 24913  0.0  0.0 325536  2160 ?        Ssl  11:55   0:00 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1

登录

Class 'Memcache' not found

在控制台中我运行 memcache,但应用程序仍然死机。需要做什么检查?

【问题讨论】:

  • 对不起,我有点困惑。 “应用程序死了”,什么应用程序? PHP会崩溃吗?你有任何错误日志吗?导致崩溃的唯一原因是添加那一行吗?
  • 找不到类“Memcache”
  • 感谢编辑!是否安装并加载了 memcache 的 PHP 扩展?仅仅拥有 memcache 系统守护进程并不能使用new Memcache;。关于该错误消息有很多问题,您在搜索它们时是否得到任何解决方案?例如stackoverflow.com/q/2659035
  • 我在sudo pecl install pecl_http-2.5.5 时解决了这个问题,因为需要 php 版本 5.6,然后在 php info 中我找到了 memcache 和 memcached

标签: php memcached


【解决方案1】:

MemcacheMemcached 是两个不同的库。

您的 php 信息显示您已安装 memcached。 错误提示您使用的是memcache

尝试安装memcache,应该没问题。

【讨论】:

    猜你喜欢
    • 2015-08-29
    • 2012-08-06
    • 1970-01-01
    • 2011-06-27
    • 2011-02-09
    • 2011-11-05
    • 2014-05-29
    相关资源
    最近更新 更多