升级libmemcached及php的memcached之pecl扩展
所需软件包
libmemcached-1.0.9 https://launchpad.net/libmemcached/1.0/1.0.9/+download/libmemcached-1.0.9.tar.gz
memcached-2.1.0 http://pecl.php.net/get/memcached-2.1.0.tgz (注意上一版本即memcached-2.0.1.tgz 这个包有bug)
系统升级如下:
CentOS release 5.5
CPU = 64-bit, OS = 64-bit
Compiler GNU CC version 4.1.2 20080704 (Red Hat 4.1.2-48)
注意:之前已经安装了libmemcached-1.0.2及php和php的扩展memcached-1.0.2
一、安装libmemcached-1.0.9
[root@niutian365 packages]# tar zxvf libmemcached-1.0.9.tar.gz
[root@niutian365 packages]# cd libmemcached-1.0.9
[root@niutian365 libmemcached-1.0.9]# ./configure --prefix=/usr/local/libmemcached --with-memcached
升级libmemcached从1.0.2升级到1.0.9编译出错如下提示:
make[1]: Entering directory `/packages/libmemcached-1.0.9'
CXX libhashkit/libhashkit_libhashkit_la-aes.lo
CXX libhashkit/libhashkit_libhashkit_la-algorithm.lo
CXX libhashkit/libhashkit_libhashkit_la-behavior.lo
CXX libhashkit/libhashkit_libhashkit_la-crc32.lo
CXX libhashkit/libhashkit_libhashkit_la-digest.lo
CXX libhashkit/libhashkit_libhashkit_la-encrypt.lo
CXX libhashkit/libhashkit_libhashkit_la-fnv_32.lo
CXX libhashkit/libhashkit_libhashkit_la-fnv_64.lo
CXX libhashkit/libhashkit_libhashkit_la-function.lo
CXX libhashkit/libhashkit_libhashkit_la-has.lo
CXX libhashkit/libhashkit_libhashkit_la-hashkit.lo
CXX libhashkit/libhashkit_libhashkit_la-jenkins.lo
CXX libhashkit/libhashkit_libhashkit_la-ketama.lo
CXX libhashkit/libhashkit_libhashkit_la-md5.lo
CXX libhashkit/libhashkit_libhashkit_la-murmur.lo
CXX libhashkit/libhashkit_libhashkit_la-one_at_a_time.lo
CXX libhashkit/libhashkit_libhashkit_la-rijndael.lo
CXX libhashkit/libhashkit_libhashkit_la-str_algorithm.lo
CXX libhashkit/libhashkit_libhashkit_la-strerror.lo
CXX libhashkit/libhashkit_libhashkit_la-string.lo
CXX libhashkit/libhashkit_libhashkit_la-nohsieh.lo
CXXLD libhashkit/libhashkit.la
CXX libmemcached/csl/libmemcached_libmemcached_la-context.lo
In file included from ./libmemcached/common.h:72,
from ./libmemcached/csl/common.h:40,
from libmemcached/csl/context.cc:38:
./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
处理如下:
[root@niutian365 libmemcached-1.0.9]# yum install gcc44 gcc44-c++ libstdc++44-devel
[root@niutian365 libmemcached-1.0.9]# export CC=/usr/bin/gcc44
[root@niutian365 libmemcached-1.0.9]# export CXX=/usr/bin/g++44
重新编译安装libmemcached-1.0.9
[root@niutian365 libmemcached-1.0.9]# ./configure --prefix=/usr/local/libmemcached --with-memcached
[root@niutian365 libmemcached-1.0.9]# make
[root@niutian365 libmemcached-1.0.9]# make install
二、升级安装php的memcached扩展memcached-2.1.0
[root@niutian365 packages]# tar zxvf memcached-2.1.0.tgz
[root@niutian365 packages]# cd memcached-2.1.0
[root@niutian365 memcached-2.1.0]# /usr/local/php/bin/phpize
[root@niutian365 memcached-2.1.0]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached
[root@niutian365 memcached-2.1.0]# make
[root@niutian365 memcached-2.1.0]# make install
重启webserver