How To Install Memcached on Fedora 23

Memcached is a high-performance distributed, in-memory caching system. It primarily is used to speed up sites that make heavy use of databases. It also can, however, be used to store any kind of object.

Most popular Content Management Systems have a plugin or module designed to take advantage of memcached, and many programming languages such as PHP, Perl, Python, and Ruby also have a memcached library.

Memcached runs in memory and is quite fast, as it does not need to write data to disk.

Pre-Flight Check

  • These instructions are intended specifically for installing Memcached on a single Fedora 23 node. If you’re using a different operating system, check out our guides to installing Memcached on Ubuntu 15.04, CentOS 6 and CentOS 7.
  • We’ll be working as root on a Liquid Web Self Managed Fedora 23 server.

Step #1: Install Memcached

First, we’ll clean up our package files:

dnf clean all

As a matter of best practice we’ll now update our packages:

dnf -y update

To install Memcached and related packages, run the command:

dnf -y install memcached

Step #2: Configure Memcached

Use the following command to view information on the memcached command:

memcached -h

The default configuration file is located at /etc/sysconfig/memcached. Open that file to view the configuration:

vim /etc/sysconfig/memcached

In vim, remember that you can press “a” to enter text insertion mode; pressing the escape key (Esc) on your keyboard returns you to command mode. For a refresher on editing files with vim, see New User Tutorial: Overview of the Vim Text Editor. If vim is not installed on your OS, you can follow our tutorial on installing vim at How to Install VIM (Visual editor IMproved) on Fedora 23.

The contents of the file should appear similar to this:

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""

  • PORT is the port on which memcached will run. By default it is 11211.
  • USER is the user as which memcached runs.
  • MAXCONN is the maximum number of connections to memcached.
  • CACHESIZE is the size of the cache, in MB.
  • OPTIONS contains any additional specified options. In this case, there are none.

If you would like to change the port (PORT), the user Memcached runs as (USER), the maximum number of allowed connections to Memcached (MAXCONN), or the cache size in megabytes (CACHESIZE), simply change the options in the configuration file.

After making any changes, save and exit the configuration file with :wq and then restart Memcached:

systemctl restart memcached

Step #3: Configure Memcached to Start on Boot

The following code will ensure that Memcached starts at boot:

systemctl enable memcached

That will produce output similar to:

[root@host ~]# systemctl enable memcached
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.

To check the status of Memcached:

systemctl status memcached

To stop Memcached:

systemctl stop memcached

To start Memcached:

systemctl start memcached

Step #4: Install the Memcached PHP Extension

If needed, install the Memcached PHP extension with the following command:

dnf -y install php-pecl-memcache

Now restart memcached and Apache for the settings to take effect:

systemctl restart memcached
systemctl restart httpd

To verify that the PHP module is loaded, run the command:

php -m | grep memcache

That should produce output similar to:

[root@host ~]# php -m | grep memcache
memcache

And finally, you can check the php.ini to confirm your Memcached settings:

php -i | grep memcache

That should produce output similar to:

[root@host ~]# php -i | grep memcache
/etc/php.d/40-memcache.ini,
memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 32768 => 32768
memcache.compress_threshold => 20000 => 20000
memcache.default_port => 11211 => 11211
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => consistent => consistent
memcache.lock_timeout => 15 => 15
memcache.max_failover_attempts => 20 => 20
memcache.protocol => ascii => ascii
memcache.redundancy => 1 => 1
memcache.session_redundancy => 2 => 2
Registered save handlers => files user memcache

 

How to Install the Memcached PHP Extension on Ubuntu 15.04

Memcached is a distributed, high-performance, in-memory caching system that is primarily used to speed up sites that make heavy use of databases. It can however be used to store objects of any kind. Nearly every popular CMS has a plugin or module to take advantage of memcached, and many programming languages have a memcached library, including PHP, Perl, Ruby, and Python. Memcached runs in memory and is thus quite speedy, since it does not need to write data to disk.

Pre-Flight Check

  • These instructions are intended specifically for installing the Memcached PHP Extension on a single Ubuntu 15.04 node.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 15.04 server, and I’ll be logged in as root.
  • Follow our tutorial on How to Install Memcached on Ubuntu 15.04 prior to this KB!

Continue reading “How to Install the Memcached PHP Extension on Ubuntu 15.04”

How to Install Memcached on Ubuntu 15.04

Memcached is a distributed, high-performance, in-memory caching system that is primarily used to speed up sites that make heavy use of databases. It can however be used to store objects of any kind. Nearly every popular CMS has a plugin or module to take advantage of memcached, and many programming languages have a memcached library, including PHP, Perl, Ruby, and Python. Memcached runs in memory and is thus quite speedy, since it does not need to write data to disk.

Pre-Flight Check

  • These instructions are intended specifically for installing Memcached on a single Ubuntu 15.04 node.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 15.04 server, and I’ll be logged in as root.

Continue reading “How to Install Memcached on Ubuntu 15.04”

What is Caching?

Caching Defined

Caching, as it pertains to hosting a website, is the temporary storage of content. This content could be images, files, bits of PHP scripts that are precompiled, HTML pages, results of database queries, and other web objects.

Why Use Caching?

Caching quickens the responsiveness of your website. You’ll also hear this concept referred to as: reducing latency, eliminating redundant processing steps, improving responsiveness, or reducing load times.

Continue reading “What is Caching?”

How to Install the Memcached PHP Extension on Fedora 21

Memcached is a distributed, high-performance, in-memory caching system that is primarily used to speed up sites that make heavy use of databases. It can however be used to store objects of any kind. Nearly every popular CMS has a plugin or module to take advantage of memcached, and many programming languages have a memcached library, including PHP, Perl, Ruby, and Python. Memcached runs in memory and is thus quite speedy, since it does not need to write data to disk.

Pre-Flight Check
  • These instructions are intended specifically for installing the Memcached PHP Extension on a single Fedora 21 node.
  • I’ll be working from a Liquid Web Self Managed Fedora 21 server, and I’ll be logged in as root.
  • Follow our tutorial on How to Install Memcached on Fedora 21 prior to this KB!
  • Apache and PHP must be installed.

Continue reading “How to Install the Memcached PHP Extension on Fedora 21”

How to Install the Memcached PHP Extension on Fedora 20

Memcached is a distributed, high-performance, in-memory caching system that is primarily used to speed up sites that make heavy use of databases. It can however be used to store objects of any kind. Nearly every popular CMS has a plugin or module to take advantage of memcached, and many programming languages have a memcached library, including PHP, Perl, Ruby, and Python. Memcached runs in memory and is thus quite speedy, since it does not need to write data to disk.

Pre-Flight Check
  • These instructions are intended specifically for installing the Memcached PHP Extension on a single Fedora 20 node.
  • I’ll be working from a Liquid Web Self Managed Fedora 20 server, and I’ll be logged in as root.
  • Follow our tutorial on How to Install Memcached on Fedora 20 prior to this KB!
  • Apache and PHP must be installed.

Continue reading “How to Install the Memcached PHP Extension on Fedora 20”

How to Install the Memcached PHP Extension on CentOS 7

Memcached is a distributed, high-performance, in-memory caching system that is primarily used to speed up sites that make heavy use of databases. It can however be used to store objects of any kind. Nearly every popular CMS has a plugin or module to take advantage of memcached, and many programming languages have a memcached library, including PHP, Perl, Ruby, and Python. Memcached runs in memory and is thus quite speedy, since it does not need to write data to disk.

Pre-Flight Check
  • These instructions are intended specifically for installing the Memcached PHP Extension on a single CentOS 7 node.
  • I’ll be working from a Liquid Web Core Managed CentOS 7 server, and I’ll be logged in as root.
  • Follow our tutorial on How to Install Memcached on CentOS 7 prior to this KB!

Continue reading “How to Install the Memcached PHP Extension on CentOS 7”

How to Install the Memcached PHP Extension on Ubuntu 12.04 LTS

Memcached is a distributed, high-performance, in-memory caching system that is primarily used to speed up sites that make heavy use of databases. It can however be used to store objects of any kind. Nearly every popular CMS has a plugin or module to take advantage of memcached, and many programming languages have a memcached library, including PHP, Perl, Ruby, and Python. Memcached runs in memory and is thus quite speedy, since it does not need to write data to disk.

Pre-Flight Check
  • These instructions are intended specifically for installing the Memcached PHP Extension on a single Ubuntu 12.04 LTS node.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 12.04 LTS server, and I’ll be logged in as root.
  • Follow our tutorial on How to Install Memcached on Ubuntu 12.04 LTS prior to this KB!

Continue reading “How to Install the Memcached PHP Extension on Ubuntu 12.04 LTS”

How to Install the Memcached PHP Extension on Ubuntu 14.04 LTS

Memcached is a distributed, high-performance, in-memory caching system that is primarily used to speed up sites that make heavy use of databases. It can however be used to store objects of any kind. Nearly every popular CMS has a plugin or module to take advantage of memcached, and many programming languages have a memcached library, including PHP, Perl, Ruby, and Python. Memcached runs in memory and is thus quite speedy, since it does not need to write data to disk.

Pre-Flight Check

  • These instructions are intended specifically for installing the Memcached PHP Extension on a single Ubuntu 14.04 LTS node.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 14.04 LTS server, and I’ll be logged in as root.
  • Follow our tutorial on How to Install Memcached on Ubuntu 14.04 LTS prior to this KB!

Continue reading “How to Install the Memcached PHP Extension on Ubuntu 14.04 LTS”

How to Install Memcached on Ubuntu 14.04 LTS

Memcached is a distributed, high-performance, in-memory caching system that is primarily used to speed up sites that make heavy use of databases. It can however be used to store objects of any kind. Nearly every popular CMS has a plugin or module to take advantage of memcached, and many programming languages have a memcached library, including PHP, Perl, Ruby, and Python. Memcached runs in memory and is thus quite speedy, since it does not need to write data to disk.

Pre-Flight Check

  • These instructions are intended specifically for installing Memcached on a single Ubuntu 14.04 LTS node.
  • I’ll be working from a Liquid Web Core Managed Ubuntu 14.04 LTS server, and I’ll be logged in as root.

Continue reading “How to Install Memcached on Ubuntu 14.04 LTS”