Installing the Memcached module for PHP on Ubuntu 12.04 LTS is as simple as can be. First let’s make sure we have Memcached installed:
sudo apt-get install memcached
On Ubuntu, the process to install the PHP module is similar to how we installed Memcached itself:
sudo apt-get install php5-memcache php5-memcached
If you’re using PHP as an Apache module you will need to restart Apache and you are using PHP with a FastCGI Process Manager you will need to restart said manager. Once restarted, pull up phpinfo()
and you should see some new sections labeled memcache
and memcached
.
Why would we need both modules? Technically, you don’t, you only need to use the one that you would like to utilize. Both modules support overlapping features of Memcached and each have their own caveats and advantages which I will save for a future post.