首页 \ 问答 \ 无法让Memcached在PHP中工作(Can't get Memcached working in PHP)

无法让Memcached在PHP中工作(Can't get Memcached working in PHP)

使用PHP memcached类时遇到问题。

我使用Apache 2.2.16和PHP 5.3.3在Ubuntu 10.10上运行LAMP环境。 我刚刚安装了我认为是memcached,但似乎可能是memcache?

我可以使用以下命令启动一个新的memcache对象:

$m = new Memcache;

哪些工作正常。 但是当我尝试并启动一个memcached对象时

$m = new Memcached();

我收到以下错误

Fatal error: Class 'Memcached' not found

当我运行'ps -A | grep Memcache'通过控制台,它会返回

ben@ben-computer:/tmp$ ps -A | grep memcache
1214 ?        00:00:00 memcached

显示正在运行的memcached进程。 phpinfo()返回memcache版本2.2.6。

但是当我进一步查看等文件夹

ben@ben-computer:/etc/default$ cat memcached 
# Set this to no to disable memcached.
ENABLE_MEMCACHED=yes

然后当我运行php -m时,它会返回memcache。

你有这样的想法,我不知道为什么memcache运行而不是memcached,任何帮助都会很棒。

编辑:

我认为这可能是libmemcached的一个问题。 我安装了libmemcached-dev软件包,但不确定它是否相同?


Having issues using the PHP memcached class.

I am running a LAMP environment on Ubuntu 10.10 with Apache 2.2.16 and PHP 5.3.3. I have just installed what I thought was memcached, but seems possibly to be memcache?

I can start a new memcache object with:

$m = new Memcache;

Which works fine. But when I try and start a memcached object

$m = new Memcached();

I get the following error

Fatal error: Class 'Memcached' not found

When I run 'ps -A | grep Memcache' through the console, it returns

ben@ben-computer:/tmp$ ps -A | grep memcache
1214 ?        00:00:00 memcached

Showing a running memcached process. phpinfo() returns memcache version 2.2.6.

But when I look further into etc folder

ben@ben-computer:/etc/default$ cat memcached 
# Set this to no to disable memcached.
ENABLE_MEMCACHED=yes

Then when i run php -m it returns memcache.

You kind of get the picture, i have no idea why memcache is running instead of memcached, any help would be great.

Edit:

I think it could be an issue with libmemcached. I installed the libmemcached-dev package, but not sure if that's the same?


原文:https://stackoverflow.com/questions/7665453
更新时间:2021-09-30 22:09

最满意答案

事实证明你需要在machine.config中定义<sectionGroup>元素 - 我不知道这一点。 例如,如果要在某处使用<Test>键,则需要将其添加到machine.config中其他位置的相应部分,如下所示: <section name="Test" .../> 。 更多信息可以在MSDN上找到。


Turns out you need to define <sectionGroup> elements in machine.config - I was not aware of that. E.g. if you want to use <Test> key somewhere, you need to add it to the appropriate section elsewhere in machine.config like this: <section name="Test" .../>. More info can be found on MSDN.

相关问答

更多