How to install Memcached on a CentOS

Posted on

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

Please reach us to us to talk more!

See also  Introduction to NativePHP: A New Era for PHP Developers

Posted in PHP, Software Development, TechnologiesTagged , , , , , , , ,

infuy
linkedin logo
twitter logo
instagram logo
facebook logo
By infuy
Infuy is an international technology leader company specialized in outsourcing services in the latest technologies. Blockchain (smart contracts, dApps and NFT marketplaces), full-stack, mobile development, and team augmentation are some of the areas where Infuy specializes in. As a software development company based in Uruguay with offices in the US, Infuy is always looking for the next big challenge, and the next big partner. As a fast-growing company, Infuy is always looking for talented and proactive people, who live up to the challenge and are as passionate as their team is about their mission to provide the best solutions to their partners, with the latest technologies, to join the team. For more information about the company and its services, please visit https://www.infuy.com/.