If I run phpinfo() it tells me that memcached is installed.
memcached memcached support enabled Version 1.0.2 libmemcached version 0.44 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();
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