‹ Articles

How to Install Memcached

Careful! We can't provide support for customizations or for any errors, downtime, or vulnerabilities you introduce through customizations.

Unless you're absolutely sure about what you're doing, you should stop now!

To install Memcached (the memcache server/daemon) on your server, SSH in to your server as the root user and run the following command:

sudo apt-get install memcached

Once installed, Memcached will listen on port 11211.

Using Memcache from PHP

To interact with the Memcached server from your PHP scripts, you need to install the PHP memcache client extension.

Memcached Statistics

You can view statistics for Memcached by running the following command (you may need to install the netcat package):

echo stats | nc 11211

The output of the above stats command will look like this:

STAT pid 15669
STAT uptime 1757436
STAT time 1392693208
STAT version 1.4.13
STAT libevent 2.0.16-stable
STAT pointer_size 64
STAT rusage_user 28.753797
STAT rusage_system 30.577911
STAT curr_connections 5
STAT total_connections 38
STAT connection_structures 6

Customizing Your Firewall for Memcached

The firewall configured by ServerPilot will block all access to Memcached from outside of your server. If you need to have other servers access Memcached, you'll need to customize your firewall using a tool like HeatShield.

Learn more about customizing your firewall.

Last updated: September 08, 2016

Still Have Questions?

Don't hesitate to contact us if you can't find the answers to your questions.