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.

Step #1: Install Memcached PHP Extension

First, clean-up yum:

yum clean all

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

yum -y update

Then installing PHP Memcached extension and related packages is now as simple as running just one command::

yum -y install php-pecl-memcache

Step #2: Verify Installation

Restart memcached and httpd:

systemctl restart memcached
systemctl restart httpd

Use the following command to view information on the installed PHP modules:

php -m | grep memcache

And look for a response similar to:

memcache

You can also verify the configuration of PHP with phpinfo. Follow our tutorial: How To: Check PHP Modules With phpinfo

Try a Free Cloud Server.

Trying a new server is a breeze, and it’ll be up and running in only a few minutes...

Be Sociable, Share!
Here's $75, Launch a New VPS Today. Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7 Heroic Support.