致命错误:在/my/path中找不到类"Memcached"

问题描述:

当我尝试时:

$mc= new Memcached();

我知道

Fatal error: Class 'Memcached' not found in /my/path

phpinfo表示/etc/php5/apache2/conf.d/20-memcached.ini是作为其他.ini文件加载的.

phpinfo says that /etc/php5/apache2/conf.d/20-memcached.ini is loaded as an additional .ini file.

此文件的内容是此文件:

The content of this file is this one :

; uncomment the next line to enable the module
extension=memcached.so

dpkg --get-selections | grep memcached

dpkg --get-selections | grep memcached

libmemcached6                                   install
memcached                                       install
php5-memcached                                  install

Kubuntu 阿帕奇2.0 php 5.4.4-1

Kubuntu Apache 2.0 php 5.4.4-1

为什么会有这个致命错误?

Why do I have this fatal error ?

基于您的评论,我认为您没有正确安装它.确保您在phpinfo()中看到了see一节,例如:

Based on your comment I don't think you have it installed properly. Make sure you see a see a section in phpinfo() such as:

memcached
memcached support   enabled
Version     x.x.x
libmemcached version    x.xx

1)获取libmemcached

2)配置程序包

3)进行安装sudo make install libmemcached

4)尝试通过使用sudo pecl install memcached

5)确保您的php.ini文件中包含extension = memcached.so

5) make sure you have extension = memcached.so in your php.ini

重新启动Apache

Restart Apache