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 wget http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz tar xvzf memcached-1.4.13.tar.gz cd memcached-1.4.13 ./configure
If you got those errors after running ./configure
error: 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 make install memcached -d -u nobody -m 512 -p 11211 127.0.0.1
OK, now you have to compile PHP with memcached
yum install php-pecl-memcache phpize
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
if you got nano command doesn’t exist, run install nano first.
yum install nano
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.