1. Download memcached, libevent, and memcache for PHP
Memcached uses the libevent Library
Memcached official: http://www.danga.com/memcached/
Libevent official version: http://monkey.org/%7Eprovos/libevent/
Memcache PHP module: http://pecl.php.net/package/memcache
2. Extract
Tar-xzvf libevent-1.4.11-stable.tar.gz
Tar-xzvf memcached-1.2.8.tar.gz
3. Configure, compile, and install
CD libevent-1.4.11-stable
./Configure -- prefix =/usr
Make
Make install
CD memcached-1.2.8
./Configure -- prefix =/usr
Make
Make install
Note:
If the libevent is not installed in the/usr directory, You need to copy/link the libevent-1.4.11.so.1 (Ln-S) to/usr/lib; otherwise memcached cannot load normally.
4. run
/usr/bin/memcached-D-M 128-l 192.168.0.124-P 11211-u nobody
Code :
/usr/bin/memcached-D-M 128-l 192.168.0.124-P 11211-u httpd
parameter explanation:
-D runs memcached in daemon mode.
-D sets the memory size available for memcached, the Unit is M.
-l sets the IP address of the listener. If it is a local machine, this parameter is usually not set.
-P sets the listening port, the default value is 11211. Therefore, you can leave this parameter Unspecified.
-u specifies the user. Root, you need to use this parameter to specify the user.
Of course, there are other parameters that can be used. Man memcached can be seen at a moment.
5. Automatic Start
VI/etc/rc. d/rc. Local
Join
Memcached-p 11211-l 192.168.0.124-D-u root-M 128
6. Make PHP available to memcached
Tar-xzvf memcache-2.2.5.tgz
CD memcache-2.2.5
/Usr/local/PHP/bin/phpize
./Configure -- enable-memcache -- With-PHP-Config =/usr/local/PHP/bin/PHP-config -- With-zlib-Dir
Make
Make install
Prompt for successful installation: Installing shared extensions:/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20060613/
Modify PHP. ini:
Extension_dir = "/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20060613 /"
Extension = memcache. So