Install rpmforge repo
$ wget
http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-*.rpm
$ rpm --install rpmforge-release-*.rpm
Install memcached:
$ yum install --enablerepo=rpmforge memcachedtest if memcached is running:
$ memcached -m 512 -u nobody -vv
start up the memcached daemon on as many spare machines as you have. The daemon has no configuration file, just a few command line options, only 3 or 4 of which you'll likely use:
$ ./memcached -d -m 2048 -l 10.0.0.40 -p 11211 -u nobody
This starts memcached up as a daemon, using 2GB of memory, and listening on IP 10.0.0.40, port 11211. The -m switch specifies the amount of memory in megabytes. The -l switch specifies the IP to listen on and finally the -p switch specifies the port to listen on. The default port is 11211 and if your machine has just 1 IP you can omit the -l parameter.
Install PHP MemCache extension
$ cd /usr/src/Copy the file memcache.so to the default module directory.
$ wget http://pecl.php.net/get/memcache-2.2.3.tgz
$ tar -xvf memcache-2.2.3.tgzcd memcache-2.2.3
$ phpize && ./configure --enable-memcache && make
$ cp /usr/src/memcache-2.2.3/modules/memcache.so
/usr/lib/php/modules/memcache.so
Edit php.ini
$ nano /etc/php.iniAnd add this line ini php.ini
extension=memcache.soRestart Apache2
$ /etc/init.d/httpd restartNow the php-memcache is installed
No comments:
Post a Comment