10 baby steps to install Memcached Server and access it with PHP

mem-8109444

Thinking of implementing caching for your php application , you are at a right place. Just in 10 simple (copy and paste) steps you can install and access Memcached Server.

Step1: Install libevent ,libmemcached and libmemcached devel (dependency)

yum install libevent
yum install libmemcached libmemcached-devel
.

Step 2: Install Memcached Server

.

Step 3: Start Memcached server

memcached -d -m 512 -l 127.0.0.1 -p 11211 -u nobody

(d = daemon, m = memory, u = user, l = IP to listen to, p = port)

.

Step 4: Check your memcached server is running successfully

.

Step 5: Connect Memcached server via telnet

.

Step 6: Check current status of Memcached Server on telnet prompt

.

Step 7: Exit telnet

.

Step 8: Install PHP client to access Memcached Server

It will make “memcache.so”, you have to just put it on your /etc/php.ini file.

.

Step 9: Restart your apache server

.

Step 10: Open your favorite editor to type below code and execute it, it will cache your data into Memcached server and access it back for you

.

Hurray!! All done! Enjoy Caching with Memcached.

Cheers!

Scroll to Top