一.安装memcached
1.下载安装libevent-2.0.18-stable.tar.gz
下载地址http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.18-stable.tar.gz
# tar vxf libevent-2.0.18-stable.tar.gz
# cd libevent-2.0.18
# ./configure --prefix=/usr/local/libevent
下载地址http://memcached.org/
# tar vxf memcached-1.4.13.tar.gz
# cd memcached-1.4.13
# ./configure --prefix=/usr/local/memcached
# make && make install
/usr/local/memcached/bin/memcached -d -m 32 -l 127.0.0.1 -p 11211 -u root
将memcached加入启动项
# vi /etc/rc.d/rc.local
按键盘上的 i 开始编辑
在最后加入
/usr/local/memcached/bin/memcached -d -m 32 -l 127.0.0.1 -p 11211 -u root
按Esc键,再输入
此处memcache主要指PHP中的Memcache,即PHP的Memcached扩展支持。
1.下载memcache
下载地址http://pecl.php.net/package/memcache
下载的版本为memcache-2.2.5.tgz
# tar -zxvf 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
# vi /usr/local/php/lib/php.ini
末尾加入
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20090626"
extension=memcache.so
按Esc键,再输入
:wq
保存退出
重启你的web服务器
#service httpd restart
3.测试memcache
在 memcache-2.2.5目录下有个memcache.php文件 拷贝到web服务器下
#cp memcache.php /usr/local/apache/htdocs/memcache.php
#cd /usr/local/apache/htdocs/
编辑memcache.php
$MEMCACHE_SERVERS[] = '127.0.0.1:11211';
浏览器http://192.168.1.56/memcache.php
输入用户名(memcache)和密码(password) 在memcache.php可修改
显示正常则配置成功
1.下载安装libevent-2.0.18-stable.tar.gz
下载地址http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.18-stable.tar.gz
# tar vxf libevent-2.0.18-stable.tar.gz
# cd libevent-2.0.18
# ./configure --prefix=/usr/local/libevent
# make && make install
下载地址http://memcached.org/
# tar vxf memcached-1.4.13.tar.gz
# cd memcached-1.4.13
# ./configure --prefix=/usr/local/memcached
# make && make install
/usr/local/memcached/bin/memcached -d -m 32 -l 127.0.0.1 -p 11211 -u root
将memcached加入启动项
# vi /etc/rc.d/rc.local
按键盘上的 i 开始编辑
在最后加入
/usr/local/memcached/bin/memcached -d -m 32 -l 127.0.0.1 -p 11211 -u root
按Esc键,再输入
:wq
此处memcache主要指PHP中的Memcache,即PHP的Memcached扩展支持。
1.下载memcache
下载地址http://pecl.php.net/package/memcache
下载的版本为memcache-2.2.5.tgz
# tar -zxvf 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
# vi /usr/local/php/lib/php.ini
末尾加入
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20090626"
extension=memcache.so
按Esc键,再输入
:wq
保存退出
重启你的web服务器
#service httpd restart
3.测试memcache
在 memcache-2.2.5目录下有个memcache.php文件 拷贝到web服务器下
#cp memcache.php /usr/local/apache/htdocs/memcache.php
#cd /usr/local/apache/htdocs/
编辑memcache.php
$MEMCACHE_SERVERS[] = '127.0.0.1:11211';
浏览器http://192.168.1.56/memcache.php
输入用户名(memcache)和密码(password) 在memcache.php可修改
显示正常则配置成功