1. Install libevent
Wget http://monkey.org /~ Provos/libevent-1.3b.tar.gz
Tar-zxf libevent-1.3b.tar.gz
CD libevent-1.3b
./Configure-Prefix =/data/libevent
Make
Make install
2. Install memcached
Wget http://www.danga.com/memcached/dist/memcached-1.2.2.tar.gz
Tar-zxf memcached-1.2.2.tar.gz
CD memcached-1.2.2
./Configure-Prefix =/data/memcached-with-libevent =/data/libevent/
Make
Make install
3. Install memcache extension for PHP
CD/data/PHP/bin/
./PECL install memcache
After the installation is complete, the system prompts you shoshould Add "Extension = memcache. So" to PhP. ini.
Modify PHP. ini
Add extension = no-debug-non-zts-20060613/memcache. So
Test/data/PHP/bin/PHP-l
4. Start memcached
#/Data/memcached/bin/memcached-D-M 1024-P 11211-u Root
/Data/memcached/bin/memcached-D-M 1024-P 11211-l 10.0.0.40-u Root
Parameter description-M specifies the number of megabytes of cache space used-l host name-P specifies the port to be listened to-u specifies the user to run
If you encounter problems when running memcached, the error prompt is as follows:
/Data/memcached/bin/memcached: Error while loading shared libraries: libevent-1.3b.so.1: cannot open shared object file: no such file or directory
Run ld_dubug = libs to know the library loading path when memcached is started. The details are as follows:
Ld_debug = libs/data/memcached/bin/memcached-V
21404: Find library = libpthread. so.0 [0]; Searching
21404: search cache =/etc/lD. So. Cache
21404: Trying file =/lib/tls/libpthread. so.0
21404:
21404: Find library = libevent-1.3b.so.1 [0]; Searching
21404: search cache =/etc/lD. So. Cache
21404: Search Path =/lib/tls/i686/sse2:/lib/tls/i686:/lib/tls/sse2:/lib/TLS:/lib/i686/sse2: /lib/i686:/lib/sse2:/lib:/usr/lib/tls/i686/sse2:/usr/lib/tls/i686: /usr/lib/tls/sse2:/usr/lib/TLS:/usr/lib/i686/sse2:/usr/lib/i686:/usr/lib/sse2: /usr/lib (system search path)
21404: Trying file =/lib/tls/i686/sse2/libevent-1.3b.so.1
21404: Trying file =/lib/tls/i686/libevent-1.3b.so.1
21404: Trying file =/lib/tls/sse2/libevent-1.3b.so.1
21404: Trying file =/lib/tls/libevent-1.3b.so.1
21404: Trying file =/lib/i686/sse2/libevent-1.3b.so.1
21404: Trying file =/lib/i686/libevent-1.3b.so.1
21404: Trying file =/lib/sse2/libevent-1.3b.so.1
21404: Trying file =/lib/libevent-1.3b.so.1
21404: Trying file =/usr/lib/tls/i686/sse2/libevent-1.3b.so.1
21404: Trying file =/usr/lib/tls/i686/libevent-1.3b.so.1
21404: Trying file =/usr/lib/tls/sse2/libevent-1.3b.so.1
21404: Trying file =/usr/lib/tls/libevent-1.3b.so.1
21404: Trying file =/usr/lib/i686/sse2/libevent-1.3b.so.1
21404: Trying file =/usr/lib/i686/libevent-1.3b.so.1
21404: Trying file =/usr/lib/sse2/libevent-1.3b.so.1
21404: Trying file =/usr/lib/libevent-1.3b.so.1
21404:
Then create a link for the libevent-1.3b.so.1:
Ln-S/data/libevent/lib/libevent-1.3b.so.1/lib/libevent-1.3b.so.1
Restart, OK.