Blog Post

How to install Memcached on a CentOS
PHP

How to install Memcached on a CentOS 

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings or objects) from results of database calls, API calls, or page rendering.  Memcached will store sessions in memory instead of files. Because memory is way faster than reading a file your website will perform better and reduce load time.

Update the repositories

yum update -y

Start the installation

yum install memcached

Configure Memcached

vi /etc/sysconfig/memcached

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="2048"
OPTIONS=""

Start Memcached
chkconfig --levels 235 memcached on
/etc/init.d/memcached start

Memcached PHP Extension

First you need to Install Pecl

yum install php-pear
yum install php-pecl-memcache

Restart Apache

/etc/init.d/httpd restart

Check Memcached plugin in PHP and enjoy it!

php -i | grep memcach
memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 8192 => 8192
memcache.default_port => 11211 => 11211
memcache.default_timeout_ms => 1000 => 1000
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => standard => standard
memcache.max_failover_attempts => 20 => 20
Registered save handlers => files user sqlite memcache

(Visited 139 times, 1 visits today)

Related posts

Leave a Reply

Required fields are marked *

en_USEnglish
en_USEnglish