Installing memcached
This article will show you how to install memcached on a (dv) Dedicated-Virtual 3.5 Server.
- First you must install the Developer Tools, and Yum Package Manager.
TIP:
It may be a good idea to update your system with yum update command before continuing.
- Grab the Files and install using yum:
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm rpm --install rpmforge-release-0.3.6-1.el5.rf.i386.rpm yum install --enablerepo=rpmforge memcached - Start memcached:
NOTE:
The "-m SIZE" is the flag for setting the memory requirements in MBs. Once this cache is filled memcache will just start to overwrite with newer content. Please experiment with this setting to find what works best for you.
memcached -d -m 512 -l 127.0.0.1 -p 11211 -u nobody - Grab the memcache PHP extension:
wget http://pecl.php.net/get/memcache-2.2.5.tgz - Untar the file:
tar -xvf memcache-2.2.5.tgz - Open the directory:
cd memcache-2.2.5 - Install the memcached PHP extension:
phpize && ./configure --enable-memcache && make - Copy the extension:
cp /root/memcache-2.2.5/modules/memcache.so /usr/lib/php/modules/ - Edit your php.ini:
vi /etc/php.ini - Add extension=memcache.so:
extension=memcache.so - Restart Apache:
/etc/init.d/httpd restart -
If you check your server using a phpinfo page you should now see a MemCache section on the page. You can now fully use the MemCache functionality in your PHP.
Notes/Supplemental Resources:
- (mt) User Forum Thread regarding memcached
- HowToForge: Installing The PHP-MemCache Module On CentOS 5.0
- Takizo: PECL Manual Install on Linux Centos
Revisions:
07-27-2009: Article Creation, thanks Seetha!
Fields marked with an asterisk(*) are required. Comment on this article