开发者

Memcached installed but class not found

If I run phpinfo() it tells me that memcached is installed.

memcached
memcached support   enabled
Version     1.0.2
libmemcached version    0.44
开发者_C百科Session support     yes
igbinary support    no 

I installed it with sudo pecl install memcached

But when I try to instantiate the memcached class it is not found:

$mc = new Memcached();

gets:

Fatal error: Class 'Memcached' not found

Never used PECL as an install mechanism before, do I need to do something extra in php.ini or somewhere to be able to use the class?


It's possible that it didn't install correctly or, as you say, you might need to add the following to php.ini: extension = memcached.so

But since you say it shows up in phpinfo() it seems more likely that it just didn't install correctly. Were there any errors in the output during installation?

Also, to state the obvious, make sure you've restarted your server.

I wrote up a tutorial on getting memcached running on Ubuntu, which I mention not to self-promote, but just in case it's helpful.


There is often a lot of confusion between 'Memcached' and 'Memcache'. It might be worth installing both to eliminate any such problems. You can use the following to install 'Memcache'

sudo apt-get install php5-memcache
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜