[{"data":1,"prerenderedAt":113},["ShallowReactive",2],{"blog:\u002Fblog\u002F2015\u002F08\u002F25\u002Fcentos-php-memcached-extension-install\u002F":3},{"id":4,"title":5,"body":6,"categories":96,"comments":98,"date":99,"description":100,"draft":101,"extension":102,"legacySlug":103,"meta":104,"navigation":98,"path":105,"seo":106,"stem":107,"tags":108,"updated":111,"__hash__":112},"blog\u002Fblog\u002F2015\u002F08\u002F25\u002Fcentos-php-memcached-extension-install.md","centos系统为php安装memcached扩展步骤",{"type":7,"value":8,"toc":93},"minimark",[9,13,18,21,25,28,32,35,46,50,60,63,66,69,75,79,82,86],[10,11,12],"p",{},"这篇文章主要介绍了centos系统为php安装memcached扩展的步骤,大家参考使用吧",[14,15,17],"h5",{"id":16},"_1通过yum安装","1.通过yum安装",[10,19,20],{},"yum -y install memcached\n#安装完成后执行:\nmemcached -h\n#出现memcached帮助信息说明安装成功",[14,22,24],{"id":23},"_2加入启动服务","2.加入启动服务",[10,26,27],{},"chkconfig --level 2345 memcached on",[14,29,31],{"id":30},"_3配置memcached","3.配置Memcached",[10,33,34],{},"vim \u002Fetc\u002Fsysconfig\u002Fmemcached\n#文件中内容如下，按需要修改:",[36,37,42],"pre",{"className":38,"code":40,"language":41},[39],"language-text","PORT=\"11211\" #端口\nUSER=\"root\" #用户名\nMAXCONN=\"1024\" #最大连接数\nCACHESIZE=\"64\" #内存大小\nOPTIONS=\"\" #附加参数\n","text",[43,44,40],"code",{"__ignoreMap":45},"",[14,47,49],{"id":48},"_4安装libmemached","4.安装libmemached",[10,51,52,53,59],{},"wget ",[54,55,56],"a",{"href":56,"rel":57},"https:\u002F\u002Flaunchpad.net\u002Flibmemcached\u002F1.0\u002F1.0.16\u002F+download\u002Flibmemcached-1.0.16.tar.gz",[58],"nofollow","\ntar -zxvf libmemcached-1.0.16.tar.gz\ncd libmemcached-1.0.16\n.\u002Fconfigure -prefix=\u002Fusr\u002Flocal\u002Flibmemcached -with-memcached\nmake && make install\n注意:这里容易报错，\n编译错误：\nlibmemcached\u002Fauto.cc: In function 'memcached_return_t text_incr_decr(memcached_server_st*, bool, const char*, size_t, uint64_t, bool)':\nlibmemcached\u002Fauto.cc:73: error: expected `)' before 'PRIu64'",[10,61,62],{},"In file included from .\u002Flibmemcached\u002Fcommon.h:72,\nfrom .\u002Flibmemcached\u002Fcsl\u002Fcommon.h:40,\nfrom libmemcached\u002Fcsl\u002Fcontext.cc:38:\n.\u002Flibmemcached-1.0\u002Fmemcached.h:46:27: error: tr1\u002Fcinttypes: No such file or directory\n原因是gcc版本过低了\n对策：libmemcached-1.0.2 版本以上升级编译器版本\n# yum install gcc44 gcc44-c++ libstdc++44-devel",[10,64,65],{},"# export CC=\u002Fusr\u002Fbin\u002Fgcc44\n# export CXX=\u002Fusr\u002Fbin\u002Fg++44\n# .\u002Fconfigure",[10,67,68],{},"如果升级gcc版本出现连接源的问题不能下载，可以换用163的yum源，参考文章",[10,70,71],{},[54,72,73],{"href":73,"rel":74},"https:\u002F\u002Fwww.zhizhi123.com\u002Fblog\u002F2015\u002F08\u002F25\u002Fcentos-yum-163-source\u002F",[58],[14,76,78],{"id":77},"_5安装php-devel","5.安装php-devel",[10,80,81],{},"yum install php-devel",[14,83,85],{"id":84},"_6安装php-memcached扩展","6.安装PHP Memcached扩展",[10,87,52,88,92],{},[54,89,90],{"href":90,"rel":91},"http:\u002F\u002Fpecl.php.net\u002Fget\u002Fmemcached-2.1.0.tgz",[58],"\ntar -zxvf memcached-2.1.0.tgz\ncd memcached-2.1.0\n\u002Fusr\u002Flocal\u002Fphp\u002Fbin\u002Fphpize\n.\u002Fconfigure -enable-memcached -with-php-config=\u002Fusr\u002Flocal\u002Fphp\u002Fbin\u002Fphp-config -with-zlib-dir -with-libmemcached-dir=\u002Fusr\u002Flocal\u002Flibmemcached -prefix=\u002Fusr\u002Flocal\u002Fphpmemcached\nmake && make install",{"title":45,"searchDepth":94,"depth":94,"links":95},2,[],[97],"PHP",true,"2015-08-25 20:36:15","这篇文章主要介绍了centos系统为php安装memcached扩展的步骤,大家参考使用吧 1.通过yum安装 yum -y install memcached \\#安装完成后执行: memcached -h \\#出现memcached帮助信息说明安装成功 2.加入启动服务 chkconfig --",false,"md","centos-php-memcached-extension-install",{},"\u002Fblog\u002F2015\u002F08\u002F25\u002Fcentos-php-memcached-extension-install",{"title":5,"description":100},"blog\u002F2015\u002F08\u002F25\u002Fcentos-php-memcached-extension-install",[109,110,97],"centos","linux",null,"wRVqtq1eDhWum-ylVaCjymZ9pB7FKIF2lyfqs2AGl1g",1783807996124]