ITPub博客

首页 > Linux操作系统 > Linux操作系统 > memcache安装配置

memcache安装配置

原创 Linux操作系统 作者:wang_0720 时间:2013-11-05 20:30:59 0 删除 编辑
下载软件
libevent-2.0.20-stable.tar.gz
memcached-1.4.15.tar.gz
libmemcached-1.0.14.tar.gz
memcached-2.1.0.tgz
编译安装libevent
tar zxf libevent-2.0.20-stable.tar.gz
cd libevent-2.0.20-stable
./configure --prefix=/usr/local/libevent && make && make install
安装memcache
tar zxf memcached-1.4.15.tar.gz
cd memcached-1.4.15
./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent && make && make install
安装php的memcache扩展
安装libmemcached
tar zxf libmemcached-1.0.14.tar.gz
cd libmemcached-1.0.14
./configure --prefix=/usr/local/libmemcached
make
出错
/libmemcached-1.0/memcached.h:46:27: error: tr1/cinttypes: No such file or directory
make[1]: *** [libmemcached/csl/libmemcached_libmemcached_la-context.lo] Error 1
make[1]: Leaving directory `/packages/libmemcached-1.0.9'
make: *** [all] Error 2

解决
安装gcc44 gcc44-c++ libstdc++44-devel
rpm -ivh -nodeps gcc44 gcc44-c++ libstdc++4-devel
export CC=/usr/bin/gcc44
export CXX=/usr/bin/g++44

继续编译安装,加参数--with-memcached
 
./configure --prefix=/usr/local/libmemcached --with-memcached
make && make install
安装memcached的php扩展
tar zxf memcached-2.1.0.tgz
cd memcached-2.1.0
没有configure文件,用phpize生成configure文件
/usr/local/php/bin/phpize 产生configure文件
./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/
make
make install
编辑php.ini,加入extension=memcache.so
cat /usr/local/lib/php.ini |grep memcache
extension=memcache.so
启动memcache
/usr/local/memcached/bin/memcached -u root -d restart -m 1500 -c 1024 -l 192.168.151.138 -p 11211 -vv >/var/log/memcache.log 2>&1
参数说明,具体见memcached -h
-p       TCP port number to listen on (default: 11211)
-U       UDP port number to listen on (default: 11211, 0 is off)
-l      interface to listen on (default: INADDR_ANY, all addresses)
              may be specified as host:port
-d            run as a daemon
-c       max simultaneous connections (default: 1024)
-m       max memory to use for items in megabytes (default: 64 MB)
-v            verbose (print errors/warnings while in event loop)
-vv           very verbose (also print client commands/reponses)
-vvv          extremely verbose (also print internal state transitions)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27181165/viewspace-775756/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-11-05

  • 博文量
    111
  • 访问量
    913469