or Memcache vs. Memcached
It seems that PHP has two memcached libraries named memcache and memcached. What is the difference and how do you know which one to use? The newer memcached PHP extension was created recently by some guys at Digg. It has some new features and performance enhancements.
Here is a quick backgrounder in naming conventions (for those unfamiliar), which explains the frustration by the question asker: For many *nix applications, the piece that does the backend work is called a “daemon” (think “service” in Windows-land), while the interface or client application is what you use to control or access the daemon. The daemon is most often named the same as the client, with the letter “d” appended to it. For example “imap” would be a client that connects to the “imapd” daemon.
This naming convention is clearly being adhered to by memcache when you read the introduction to the memcache module (notice the distinction between memcache and memcached in this excerpt):
Memcache module provides handy procedural and object oriented interface to memcached, highly effective caching daemon, which was especially designed to decrease database load in dynamic web applications.
The Memcache module also provides a session handler (memcache).
More information about memcached can be found at
The frustration here is caused by the author of the PHP extension which was badly named memcached, since it shares the same name as the actual daemon called memcached. Notice also that in the introduction to memcached (the php module), it makes mention of libmemcached, which is the shared library (or API) that is used by the module to access the memcached daemon:
memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
This extension uses libmemcached library to provide API for communicating with memcached servers. It also provides a session handler (memcached).
Information about libmemcached can be found at
In summary, both are functionally the same, but they simply have different authors, and the one is simply named more appropriately than the other.
The most important features that memcached has are:
Create a temporary folder
1. As it is a manually work, you might want to clear the source file after the installation, so create a folder as command below.
To install memcache, you will need LibEvent, go to their site to get the latest version.
tar zxvf libevent-1.4.14b-stable.tar.gz
Now, install the memcache and get the latest version from their site.
tar zxvf memcached-1.4.5.tar.gz
Install PHP Memcache
Now, install PECL Memcache and get the latest version.
tar zxvf memcache-2.2.6.tgz
Find the extension as below and if it is not existed, add it in the php.ini.
Restart the Apache services.
A good comparison of the 2 versions is here: