PHP Ubuntu

How To Install Memcached on Ubuntu 16.04


How To Install Memcached on Ubuntu 16.04

Memcached works to reinforce performance by keeping a duplicate of normally used script components among the server’s memory in an exceedingly kind that’s a lot of simply scan by the server therefore reducing time. A bonus feature of this object cacher is its ability to decrease the quantity of connections to your info. During this tutorial, we tend to instruct a way to install Memcached, however it’s necessary to notice that once exploitation Memcache in Associate in Nursing application, the appliance should be specially coded or organized to store and retrieve knowledge this cached knowledge.


Installation of Memcached

Step 1:

Following best practices, we will do a quick package update by using the following command:

apt-get update


Install the Memcached daemon using

apt-get install memcached -y


Install the Memcache module for PHP fuctionality:

apt-get install php-memcached -y

Verify installation of Memcached

Use the php -m flag to show compiled modules while sorting through specifically looking for memcached.

php -m | grep memcached

Optional Configurations

At some point, you may find that you need to change the default settings of Memcached. These include adjusting the port number, memory for your cache, and the listening IP address.

vim /etc/memcached.conf

Adjust these configurations by keeping the same flags (-m, -p, -u, -l), adjusting the letter or number after the flag and save the file by typing:

# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
# Note that the daemon will grow to this size, but does not start out holding this much
# memory
-m 64
# Default connection port is 11211
-p 11211
# Run the daemon as root. The start-memcached will default to running as root if no
# -u command is present in this config file
-u memcache
# Specify which IP address to listen on. The default is to listen on all IP addresses
# This parameter is one of the only security measures that memcached has, so make sure
# it's listening on a firewalled interface.

Restart your Memcached service to recognize the changes to this file:

systemctl restart memcached

About the author

Wikitechy Editor

Wikitechy Founder, Author, International Speaker, and Job Consultant. My role as the CEO of Wikitechy, I help businesses build their next generation digital platforms and help with their product innovation and growth strategy. I'm a frequent speaker at tech conferences and events.

Add Comment

Click here to post a comment