Install pecl memcached extension in CentOS

Posted: July 5, 2014 in PHP

PHP has two memcache extension, one is memcache, the other is memcached, which is badly named (confused with the daemon name), but arguably better.

To install memcached via PECL should be easier, but unfortunately the libmemcached come with CentOS repository doesn’t work with the memcached 2.2.0, which is the latest version in PECL right now.

My solution is

  • Install the memcached daemon via yum, if not installed yet.
    • Start the service: service memcached start
  • Remove the existing libmemcached and compile and install from the source in libmemcached website. https://launchpad.net/libmemcached/+download. I installed 1.0.18.
    • ./configure
    • make
    • make install
  • Download the memcached 2.2.0 from PECL website or via command “pecl download memcached”
  • tar -xvzf memcached-2.2.0.tar.gz
  • cd memcached-2.2.0
  • phpize
  • ./configure
  • make
  • make install
  • echo “extension=memcached.so” > /etc/php.d/memcached.ini
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s