Memcached is a high-performance distributed memory object caching system for dynamic Web applications to mitigate the load on a database. It reduces the number of times a database is read by caching data and objects in memory, thus speeding up the dynamic data-driven Web site.
Memcached is the event triggered by Libevent, first loaded libevent.
wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
[Email protected] src]# TAR-XZVF libevent-2.0.21-stable.tar.gz [[email protected] libevent-2.0.21-stable]# pwd/usr/ Local/src/libevent-2.0.21-stable[[email protected] libevent-2.0.21-stable]#./configure--prefix=/usr/local/ Libevent[[email protected] libevent-2.0.21-stable]# make && make install
Next install memcached:
[Email protected] src]# wget http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/ 36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz
[Email protected] src]# TAR-XZVF memcached-1.4.15.tar.gz [[email protected] src]# CD Memcached-1.4.15[[email protected] memcached-1.4.15]#./configure--prefix=/usr/local/memcached--with-libevent=/usr/local/libevent[[email protected] memcached-1.4.15]# make && make install
Installing the PHP Extension Module memcache
[Email protected] src]# wget http://pecl.php.net/get/memcache-2.2.6.tgz
[Email protected] src]# CD memcache-2.2.6
[Email protected] memcache-2.2.6]#/usr/local/php/bin/phpize
Configuring for:
PHP Api version:20121113
Zend Module Api no:20121212
Zend Extension Api no:220121212
[Email protected] memcache-2.2.6]#/configure--enable-memcache--with-php-config=/usr/local/php/bin/php-config-- With-zlib-dir
[[email protected] memcache-2.2.6]# make && make install
The installation succeeds with a hint similar to the following: Build complete.
Don ' t forget to run ' make test '.
Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/
[Email protected] memcache-2.2.6]# egrep ' Memcache|extension_dir '/etc/php.ini
[Memcache]
Extension_dir= "/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/"
Extension=memcache.so
; Extension_dir = "./"
; Extension_dir = "ext"
; Be sure to appropriately set the EXTENSION_DIR directive.
; Sqlite3.extension_dir =
Start Memcache[[email protected] memcache-2.2.6]#/usr/local/memcached/bin/memcached-d-u root-m 63-p 11211-c 10240
[Email protected] memcache-2.2.6]# service php-fpm restartgracefully shutting down php-fpm. Donestarting php-fpm Done
Install memcached server and add memcache extension module in PHP