Installing Memcached on Centos 5
The following post is a tutorial on how to install memcached and memcache php extension on Centos 5. Before you start there are a few useful points that might come in handing if you come across any errors.
php.ini file is kept in
/etc/php.ini
To find out where your php.ini file is kept you can type the following command
php -i | grep php.ini
The default extensions loaded are kept in this folder
/etc/php.d/
The actual php extensions are kept in
/usr/lib64/php/modules/
Install Memcached
Enable the following repository.
For i386 / i686
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
For x86_64
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
Use the command Yum to install memcached
yum -y install memcached
If no error popup then you have successfully installed memcache. You should then configure memcache by typing the following command.
vi /etc/sysconfig/memcached
you should see:
PORT="11211" #define on which port to urn USER="nobody" #same as apache user MAXCONN="1024" #maximum number of connections allowed CACHESIZE="64" #memory used for caching OPTIONS="" #use for any custom options
Start memcached
/etc/init.d/memcached start
Check it running
/etc/init.d/memcached status
or
netstat -anp | grep 11211
To stop / restart memcache
service memcached stop service memcached restart
To See Memory Memcached Slabs
memcached-tool IP_ADDRESS:Port memcached-tool IP_ADDRESS:Port display memcached-tool 127.0.0.1:11211
To See Memory Memcached Stats
memcached-tool IP_Address:Port stats memcached-tool 127.0.0.1:11211 stats
Install Memcache PHP Extension
Download and install lastest memcache version.
cd /usr/src wget http://pecl.php.net/get/memcache-2.2.5.tgz tar zxvf memcache-2.2.5.tgz cd memcache-2.2.5 phpize ./configure make make install
“configure: error: no acceptable C compiler found in $PATH”
If for some reason the above code errors saying something like you do not have a compiler installed run the following command.
yum install gcc
Add memcache extension to php.ini file (depending on your version of PHP you may not need this step)
vi /etc/php.ini
Press the key => i
Scroll don until you see a large block of code saying extension = …. Then add the following
extension = "memcache.so"
To check memcache is correctly installed with php
php -i | grep memcache
Finally Restart Apache
/etc/init.d/apache2 restart
Special Thanks
This post would not have been possible without the follow tutorials and articles. I highly recommend you check them out as they list different techniques and include other information like how to start memcache as a service.
http://www.cyberciti.biz/faq/rhel-fedora-linux-install-memcached-caching-system-rpm/ http://codelikezell.com/how-to-install-memcached-on-centos/ http://www.lullabot.com/articles/installing-memcached-redhat-or-centos http://www.sohailriaz.com/how-to-install-memcached-with-memcache-php-extension-on-centos-5x/
Related posts:
Recent Posts
- Diary of a Startup: I’ve Just Applied to Seedcamp
- Diary of a Startup: Create a startup for £14
- Sendmail on Ubuntu
- Adobe Air with Netbeans
- Best Firefox Plugins for SEO aka Addons
- Setup Ubuntu as a Web Server
- Changing Plesk Fast CGI to Apache PHP with ZF
- How to Access PUT data in Zend Framework
- 30 minutes until 30!
- Google Analytics Benchmarking Newsletter July 2011
My External Links
Twitter Updates
- I'm at Earls Restaurant (229 Banff Ave, Wolf St, Banff) http://t.co/mYqKENLt 3 days ago
- New Local Dark Ale. Lovely @ Earl's - Banff http://t.co/otFtzHbQ 1 week ago
- I'm at Calgary International Airport (YYC) (2000 Airport Rd. N.E., Calgary) w/ 7 others http://t.co/IRI8zsHj 1 week ago
- I'm at BA Galleries Club Lounge South (at Terminal 5, LHR Airport, Heathrow) w/ 3 others http://t.co/FikQ8bSQ 1 week ago
- I'm at Terminal 5 (LHR Airport, 234 Bath Rd., Hounslow) w/ 8 others http://t.co/IbyWsNNf 1 week ago
- I'm at Yum Yum (5B Brewery Place, Brewery Wharf, Leeds) http://t.co/DKzTstpt 2 weeks ago
- RT @YahooFinance: The Case for a 21-Hour Work Week http://t.co/UFru9Pwy 3 weeks ago
- How Facebook's Expected $100 Billion IPO Breaks Down [INFOGRAPHIC] http://t.co/GxGMffP6 via @mashable 3 weeks ago
- I'm at Old Broadcasting House (Leeds Metropolitan University, at Civic Quarter, Leeds) w/ 4 others http://t.co/8M32KNy5 3 weeks ago
- Start 2012 by Taking 2 Minutes to Clean Your Apps Permissions. http://t.co/ltxMfrow 1 month ago




