How to Install memcached on CentOS 6

I tried to find a good tutorial for installing memcached on CentOS 6. However, none of articles contains comprehensive information which you may need to troubleshoot during installation.

I tested below linux commands on three different platforms which include fresh installed CentOS 6, CentOS 6 with webuzo(1.9.0) installed and CentOS 6 with Cpanel/WHM installed.

install php mysql first ( ONLY On fresh installed CentOS 6 )

yum install mysql mysql-server php php-mysql

unlikely you’ll experience any errors during PHP and Mysql installation.

Run below commands one by one.

yum install libevent libevent-devel

cd /usr/local/src

tar xvzf memcached-1.4.13.tar.gz
cd memcached-1.4.13

If you got those errors after running ./configure

checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/memcached-1.4.13':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

Run this first

yum install gcc

and then rerun


Below it’s option when you run ./configure

./configure --enable-64bit # if you use 64bit centOS
./configure --enable-threads # if you CPU is mutli-core CPUs
./configure --enable-threads --enable-64bit # if you got both
make install
memcached -d -u nobody -m 512 -p 11211

OK, now you have to compile PHP with memcached

yum install php-pecl-memcache

If you got those errors after you run phpize command

sh: phpize: command not found
ERROR: `phpize' failed

run this first.

yum -y install php-devel

and then run

pecl install memcache

run those commands only if you get zlib errors.

yum install zlib-devel

and now edit php.ini file

nano /etc/php.ini


if you got nano command doesn’t exist, run install nano first.

yum install nano

Restart Httpd

/etc/init.d/httpd restart

check if memcached is running

ps -ef | grep memcached


php -i | grep memcache

If your Dedicated server or VPS already had Cpanel/WHM installed, skip yum install nano, and if you already had memcache installed by using easyapache, you only need to compile PHP with memcache.

3 thoughts on “How to Install memcached on CentOS 6”

  1. Hi,
    I’m trying to install memcached segunedo your guide.
    I’m stuck at phpize because it gives me this error:

    # phpize
    Cannot find config.m4.
    Make sure that you run ‘/usr/bin/phpize’ in the top level source directory of the module
    Do you have any suggestions please, (I’m newbie)?


Leave a Reply

Your email address will not be published. Required fields are marked *