标签:
准备安装包:
libevent-2.0.21-stable.tar.gz //Memcached服务端的依赖包
memcached-1.4.29.tar.gz //Memcached服务端
libmemcached-1.0.18.tar.gz //Memcached扩展的依赖包
memcached-2.2.0.tgz //php的Memcached扩展
1、安装libevent
[root@localhost src]# tar -zxvf libevent-2.0.21-stable.tar.gz [root@localhost src]# cd libevent-2.0.21-stable [root@localhost libevent-2.0.21-stable]# ./configure --prefix=/usr/local/libevent [root@localhost libevent-2.0.21-stable]# make [root@localhost libevent-2.0.21-stable]# make install
2、安装Memcached服务端
[root@localhost src]# tar -zxvf memcached-1.4.29.tar.gz [root@localhost src]# cd memcached-1.4.29 [root@localhost memcached-1.4.29]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent [root@localhost memcached-1.4.29]# make [root@localhost memcached-1.4.29]# make install
3、启动Memcached服务
[root@localhost /] /usr/local/memcached/bin/memcached -d -m 256 -u root -p 11211 -c 1024 -P /tmp/memcached.pid
-d选项是启动一个守护进程,
-m是分配给Memcache使用的内存数量,单位是MB.
-u是运行Memcache的用户.
-l是监听的服务器IP地址,我这里没有填.
-p是设置Memcache监听的端口.
-c选项是最大运行的并发连接数,默认是1024,按照你服务器的负载量来设定.
-P是设置保存Memcache的pid文件.
4、安装Memcached扩展的依赖包
[root@localhost src]# tar -zxvf libmemcached-1.0.18.tar.gz [root@localhost src]# cd libmemcached-1.0.18 [root@localhost libmemcached-1.0.18]# ./configure --prefix=/usr/local/libmemcached --with-memcached=/usr/local/memcached/bin/memcached [root@localhost libmemcached-1.0.18]# make
make的时候出现:./libtool: line 1125: g++: command not found 错误
[root@localhost /]# yum -y install gcc+ gcc-c++
然后重新安装
[root@localhost libmemcached-1.0.18]# ./configure --prefix=/usr/local/libmemcached --with-memcached=/usr/local/memcached/bin/memcached [root@localhost libmemcached-1.0.18]# make [root@localhost libmemcached-1.0.18]# make install
5、安装Memcached PHP扩展
[root@localhost src]# tar -zxvf memcached-2.2.0.tgz [root@localhost src]# cd memcached-2.2.0 [root@localhost memcached-2.2.0]# /usr/local/php/bin/phpize Configuring for: PHP Api Version: 20121113 Zend Module Api No: 20121212 Zend Extension Api No: 220121212 [root@localhost memcached-2.2.0]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached ... ... ---------------------------------------------------------------------- Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/
6、配置php.ini
7、重启服务器
标签:
原文地址:http://www.cnblogs.com/tianxintian22/p/5673099.html