fbpx

Install and configure Memcache

Install and configure Memcache

Memcache is a system that works to speed up virtual private servers by caching server information. The program allows you to allocate a specific amount of the server ram toward caching recently queried data for a certain amount of time. Once the data is requested again, memcache speeds up the process of retrieving it by displaying the cached information instead of generating the result from the database.
This is the guide to install memcache on ubuntu server. PHP should be installed on the server before following this tutorial.
PHP package to run memcache

sudo apt-get install php5-memcache

Install memcache server

sudo apt-get install memcached

The next step is to install php-pear, the repository that stores memcache.

sudo apt-get install php-pear

If you do not have a compiler on your server, you can download build-essential in order to install memcache

sudo apt-get install build-essential

Finally use PECL (PHP Extension Community Library) to install memcache

sudo pecl install memcache

Add memcached to memcache.ini

sudo echo "extension=memcache.so" > sudo /etc/php5/conf.d/memcache.ini

Restart apache to see memcache working on your application

sudo /etc/init.d/apache2 restart

After Memcache is downloaded, you can check that it has been installed by searching for it

ps aux | grep memcache

This command will output memcache stats

echo "stats settings" | nc localhost 11211

 
 

Share this post