This article is outdated and may not work correctly for current operating systems or software.
Memcached is a high-performance database system that can help supercharge your application. It's very fast as it does not write to the disk, but instead to system memory.
In this guide, I will explain how to install Memcached on an Ubuntu 14.04 server. This guide covers installing the PHP Memcached plugin too.
There is some required software you need in order to be able to use Memcache:
If you do not have these installed yet, install them with
apt-get install mysql-server php5-mysql php5
Once you have MySQL and PHP installed, it's time to install Memcache. You can install Memcached by using
apt-get install memcached
After installing Memcache, you will need to install its PHP extension. This allows for communication between PHP and Memcache:
apt-get install php5-memcached
You may receive the following error:
E: Unable to locate package php5-memcached
If so, update your
apt-get repository list:
After that's finished, try again.
The configuration file is located at:
Open this file with your favorite text editor should you want to change the port Memcached runs on, the maximum memory, or the number of simultaneous connections.
Once you have changed these settings, restart the
service memcached restart
Congratulations! Memcached is installed on your Ubuntu 14.04 server. You can now configure your applications so that they will use the Memcached database.