Happy new year all! Just a quick post about how to install Memcache in PHP on an Ubuntu or Debian server (I think it will apply to Redhat based servers, just substitute the apt-get for yum).
Log on to your server as root (either directly or using sudo su), then install the Memcache daemon through apt:
apt-get install memcached
Once installed you need to install the Memcache module into PHP. This is done through PECL which in turn is installed through PEAR. When they are both installed, you need to run the command:
pecl install memcache
This will install the memcache extension, and once done will tell you to add the the line “extension=memcache.so” into your php.ini file. I prefer keeping these in separate files (so that the php.ini file can be updated). The easy way to do this is:
echo "extension=memcache.so" > /etc/php5/conf.d/memcache.ini
And finally, reload Apache
/etc/init.d/apache2 reload
If successful, Memcache will now appear in your phpinfo().
Thanks man, this worked perfect on Ubuntu 10.10
🙂
On Ubuntu 10.10 I did the following:
1. sudo apt-get install memcached
2. sudo apt-get install php5-memcache
3. sudo /etc/init.d/apache2 reload
This did everything you mentioned above including the memcache.ini file.
Ah yes. I prefer to use the pecl/pear packages where possible as they are kept more up to date than the Ubuntu/Debian repositories.
Thanks very much. I also installed using the apt-get/non-PECL version as it’s easier for a non-sysadmin to keep track of (just using this on a VM for now), but it’s worth mentioning that there is php5-memcache AND php5-memcached as well, as per this article from Fri, 2011-11-25
http://www.howtoforge.com/install-memcached-and-php5-memcached-module-on-debian-6.0-squeeze