1. Prepare the installation package:
Libevent-2.1.8-stable.tar.gz
Memcached-1.5.0.tar.gz
Memcache-2.2.7.tgz
2. Installing Libevent
Tar xf/opt/libevent-2.1.8-stable.tar.gz
CD libevent-2.1.8-stable
Mkdir/usr/local/libevent
./configure--prefix=/usr/local/libevent
Make && make install
echo $?
3. Installing memcached
Tar XF memcached-1.5.0.tar.gz-c/opt/
Mkdir/usr/local/memcached
cd/opt/memcached-1.5.0
./configure--prefix=/usr/local/memcached--with-libevent=/usr/local/libevent
Make && make install
ID www
memcached parameters
The-D option is to start a daemon,
-M is the amount of memory allocated to Memcache, in megabytes
-U is the user running memcache, and if it is currently root, you need to specify the user with this parameter.
-L is the server IP address of the listener
-P is the port that sets Memcache listening, preferably a port above 1024
-C is the maximum number of concurrent connections to run, default is 1024
-P is set to save memcache PID file, I am here to save in/tmp/memcached.pid
4. Normal User startup memcached:
/usr/local/memcached/bin/memcached-d-u www-m 4096-l 127.0.0.1-c 10000-p 11313-p/tmp/11313.pid
5. Inspection services:
[Email protected] memcached-1.5.0]# Netstat-lp | grep memcached
TCP 0 0 localhost:11313 *:* LISTEN 19688/memcached
UDP 0 0 localhost:11313 *:* 19688/memcached
6. Install PHP extension memcache
Tar xf/opt/memcache-2.2.7.tgz-c/opt/
cd/opt/memcache-2.2.7
Find/-name "Php-config"
/usr/local/php/bin/phpize
./configure--enable-memcache=/usr/local/memcached--with-php-config=/usr/local/php/bin/php-config
Make &&make Install
[Email protected] vhost]# Tail-2/usr/local/php/etc/php.ini
[Memcache]
Extension = memcache.so
[Email protected] vhost]# Tail-2/usr/local/php/etc/php.ini
[Memcache]
Extension = memcache.so
7. Test:
Cat test.php
<?php
Phpinfo ()
?>
This article is from the "10931853" blog, please be sure to keep this source http://wujianwei.blog.51cto.com/10931853/1961541
memcached Installation and PHP extension memcache installation