64位 Centos 5.4 安装memcache详细步骤及问题汇总

1、安装libevent

tar -zxvf libevent-1.4.13-stable.tar.gz

cd libevent-1.4.13-stable

./configure --prefix=/usr

make

make install

测试libevent是否安装成功:

ls -al /usr/lib | grep libevent

2、安装服务端memcached

tar -zxvf memcached-1.4.4.tar.gz

cd memcached-1.4.4

./configure --prefix=/usr --with-libevent

make

make install

测试是否成功安装memcached:

ls -al /usr/bin/mem*

4.开启memcached

cd /opt/memcached/bin

./memcached -d -m 256 -p 11211 -u root

在 64bit 系统启动,会报找不到 libenent,可以如下操作

cp -R /usr/lib/libevent* /usr/lib64/

查看状态

watch "echo stats | nc 127.0.0.1 11211"

5.安装php memcache 扩展

tar -zxvf memcache-2.2.4.tgz

cd memcache-2.2.4

whereis php-config 查看php-config位置

whereis phpize 查看phpize位置

phpize && ./configure –enable-memcache –with-php-config=/opt/php/bin/php-config

make

make test

make install

如果参数报错:

configure: error:

You've configured extension memcache, which depends on extension session,

but you've either not enabled session, or have disabled it.

添加编译参数 --disable-memcache-session

vi /opt/apache/conf/php.ini

extension_dir = "/opt/php/lib/php/extensions/no-debug-zts-20060613/"

extension = "memcache.so"

6.安装在线 memcached 工具

wget http://livebookmark.net/memcachephp/memcachephp.zip

put memcache.php file to wwwroot

vi memcache.php

define('ADMIN_USERNAME','user'); // Admin Username

define('ADMIN_PASSWORD','pass'); // Admin Password

$MEMCACHE_SERVERS[] = '127.0.0.1:11211'; // add more as an array

最新评论:

no.10237 23xmwabmvnu 188.143.232.32 2016-06-08 13:59

That's way more clever than I was exetpcing. Thanks!

发表评论:

邮箱: