centos系统为php安装memcached扩展

这篇文章主要介绍了centos系统为php安装memcached扩展的步骤,你们参考使用吧
       1. 经过yum安装php

yum -y install memcached
#安装完成后执行:
memcached -h
#出现memcached帮助信息说明安装成功c++

2. 加入启动服务vim

chkconfig --level 2345 memcached oncentos

3. 配置Memcachedmemcached

vim /etc/sysconfig/memcached
#文件中内容以下,按须要修改:
PORT="11211" #端口
USER="root" #用户名
MAXCONN="1024" #最大链接数
CACHESIZE="64" #内存大小
OPTIONS="" #附加参数ui

4. 安装libmemachedspa

wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz
tar -zxvf libmemcached-1.0.16.tar.gz
cd libmemcached-1.0.16
./configure -prefix=/usr/local/libmemcached -with-memcached
make && make install
注意:这里容易报错,
编译错误:
libmemcached/auto.cc: In function 'memcached_return_t text_incr_decr(memcached_server_st*, bool, const char*, size_t, uint64_t, bool)':
libmemcached/auto.cc:73: error: expected `)' before 'PRIu64'.net

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
缘由是gcc版本太低了
对策:libmemcached-1.0.2 版本以上升级编译器版本
# yum install gcc44 gcc44-c++ libstdc++44-develorm

# export CC=/usr/bin/gcc44
# export CXX=/usr/bin/g++44
# ./configureserver

若是升级gcc版本出现链接源的问题不能下载,能够换用163的yum源,参考文章

http://back.zhizhi123.com/?p=109

5. 安装php-devel

yum install php-devel

6. 安装PHP Memcached扩展

wget http://pecl.php.net/get/memcached-2.1.0.tgztar -zxvf memcached-2.1.0.tgzcd memcached-2.1.0/usr/local/php/bin/phpize./configure -enable-memcached -with-php-config=/usr/local/php/bin/php-config -with-zlib-dir -with-libmemcached-dir=/usr/local/libmemcached -prefix=/usr/local/phpmemcachedmake && make install

相关文章
相关标签/搜索