PHP 的 Memcached扩展使用了 libmemcached 库提供的 api 与 memcached 服务端进行交互。它同样提供了一个 session 处理器(memcached)。

PHP 的 Memcached 扩展支持 getMulti,setMulti 等方法,而 Memcache 扩展则不支持;

在安装 Memcached 扩展的时候需要先安装 libmemcached,libmemcached 是 Memcached 的 C 客户端,它具有的优点是低内存,线程安全等特点,在高并发下,稳定性果断提高。

首先安装 libmemcached 1.0.18

进入 /usr/local/src ,下载源码包:

[root@localhost src]# wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

  

解压:

[root@localhost src]# tar -zxvf libmemcached-1.0.18.tar.gz

  

进入解压后文件夹:

[root@localhost libmemcached-1.0.18]# cd libmemcached-1.0.18

 

配置:

[root@localhost libmemcached-1.0.18]# ./configure --prefix=/usr/local/libmemcached --with-memcached

  

编译和安装:

[root@localhost libmemcached-1.0.18]# make && make install

  

PHP 的 Memcached 2.2.0 扩展的安装

进入 /usr/lcoal/src ,下载扩展的源码包:

[root@localhost src]# wget https://launchpad.net/libmemcached/+download/memcached-2.2.0.tgz

  

解压:

[root@localhost src]# tar -zxvf memcached-2.2.0.tgz

  

进入解压后目录:

[root@localhost src]# cd memcached-2.2.0

  

用 phpize 给 PHP 动态添加扩展:

[root@localhost memcached-2.2.0]# /usr/local/php/bin/phpize

  

配置:

[root@localhost memcached-2.2.0]#./configure  --with-memcached -with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --enable-memcached

如果报错:

configure: error: no, sasl.h is not available. Run configure with --disable-memcached-sasl to disable this check

那么配置改为:

[root@localhost memcached-2.2.0]# ./configure  --with-memcached -with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --enable-memcached --disable-memcached-sasl

  

编译和安装:

[root@localhost memcached-2.2.0]# make && make install

安装完成:

  

这时会生成一个 memcached.so 文件:

/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/

打开 php.ini 文件,添加一条"extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/memcached.so"

重启 LNMP。

访问 phpinfo:

参考:

php memcached扩展的安装

Linux基于libmemcached,php扩展memcached的安装

CentOS 6.6 安装 PHP Memcached 扩展的更多相关文章

  1. centos 安装php7 memcached扩展

    在使用下面这种方式安装php7 memcached扩展时,先要安装好memcached服务器yum -y install php70w-pecl-memcached

  2. 安装PHP memcached扩展

    引用 pecl.php.net有两个memcache扩展: memcache   memcached extension memcached PHP extension for interfacing ...

  3. CentOS-6.4 安装 PHP Memcached 扩展

    1.获取安装文件包 [root@phpdragon home]# wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmem ...

  4. linux centos系统 php安装GD库扩展

    yum --enablerepo=remi-php56 install php-gd php-mysql php-mbstring php-xml php-mcrypt //安装GD库扩展 servi ...

  5. Cent OS 6.5安装 php memcached扩展

    首先查看memcache的依赖库是否有安装,如果对这个有疑问可以参考php手册的memcache的安装需求说明 命令如下: 查询: rpm -qa | grep libevent 安装:yum -y ...

  6. centos 6.5 安装php redis 扩展

    一.安装: 其中,添加PHP扩展需要用到 phpize,所以我们需要安装 php-devel 这个包. #yum install php-devel 然后编译安装phpredis: #git clon ...

  7. Centos 下php安装配置xdebug扩展

    2018年05月02日 19:54:42 杨汉松 阅读数:44   1.下载安装xdebug 获取xdebug wget http://www.xdebug.org/files/xdebug-2.3. ...

  8. (转发)centos,redhat 系统为php安装memcached扩展

    转自:http://www.itnose.net/detail/6111623.html 1. 通过yum安装 yum -y install memcached #安装完成后执行: memcached ...

  9. centos系统为php安装memcached扩展

    1. 通过yum安装 yum -y install memcached #安装完成后执行: memcached -h #出现memcached帮助信息说明安装成功 2. 加入启动服务 chkconfi ...

随机推荐

  1. idea 开发环境jdk崩溃

    ## A fatal error has been detected by the Java Runtime Environment:## EXCEPTION_ACCESS_VIOLATION (0x ...

  2. CSS3-样式继承,层叠管理,文本格式化

  3. 停靠技术 Dock

    C:\Program Files\Borland\Delphi7\Demos\Docking   delphi例子 网上文档 http://www.docin.com/p-95543759.html

  4. angular的post请求,SpringMVC后台接收不到参数值的解决方案

    http://www.ithao123.cn/content-6567265.html

  5. BZOJ1858[Scoi2010]序列操作 题解

    题目大意: 有一个01序列,现在对于这个序列有五种变换操作和询问操作: 0 a b 把[a, b]区间内的所有数全变成0:1 a b 把[a, b]区间内的所有数全变成1:2 a b 把[a,b]区间 ...

  6. ubifs核心对象 -- TNC和LPT

              文件系统的核心问题是存储.这里面隐含2个问题:1)存储什么?2)存储到哪里?文件系统中的各种技术手段都是如何高效的解决这2个问题.ubifs用node标准化每一个存储对象,用lpr ...

  7. 当编译AFNetworking 2.0时出现了Undefined symbols for architecture i386

    当将AFNetworking添加到工程后编译时出现 Undefined symbols for architecture i386: "_SecCertificateCopyData&quo ...

  8. [Leetcode] Next Permutation

    Implement next permutation, which rearranges numbers into the lexicographically next greater permuta ...

  9. web安全测试

  10. [深入浅出WP8.1(Runtime)]生成图片和存储生成的图片文件

    7.2.3 使用RenderTargetBitmap类生成图片 RenderTargetBitmap类可以将可视化对象转换为位图,也就是说它可以将任意的UIElement以位图的形式呈现.那么我们在实 ...