memcached的1.2.4及以上增加了CAS(Check and Set)协议,对于同一key的多进行程的并发处理问题。这种情况其实根数据库很像,如果同时有几个进程对同一个表的同一数据进行更新的话,那会不会打架呢,哈哈。数据库里面可以锁定整张表,也可以锁定表里面一 行的功能,其实memcached加入的CAS根这个差不多。

php的扩展memcache,不支持cas,所以我们要装memcached扩展,memcached扩展是基于libmemcached,所以要先安装libmemcached

tar
zxvf libmemcached-0.42.tar.gz

cd libmemcached-0.42

./configure
--prefix=/usr/local/libmemcached  --with-memcached  --enable-sasl

make && make install

tar
zxvf memcached-1.0.2.tar.gz

cd memcached-1.0.2

/usr/local/php/bin/phpize

./configure --enable-memcached
--with-php-config=/usr/local/php/bin/php-config
--with-libmemcached-dir=/usr/local/libmemcached   --enable-memcached-sasl

make
&& make install

vi
/usr/local/php/lib/php.ini

加上extension=memcached.so重起一下服务就可以了。

------------------------------------------------------------

【centosphp安装memcached扩展支持sasl】

【http://www.2cto.com/os/201411/353283.html】

1.安装sasl

?

1

2

yum install cyrus-sasl-lib.x86_64

yum install cyrus-sasl-devel.x86_64

2.下载libmemcached

?

1

wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz

3,编译安装

?

1

2

3

4

5

tar zxvf libmemcached-1.0.16.tar.gz

cd libmemcached-1.0.16

./configure --prefix=/usr/local/libmemcached
--enable-sasl

make

make install

4.安装memcached安装

?

1

2

3

wget http://pecl.php.net/get/memcached-2.1.0.tgz

tar zxvf memcached-2.1.0.tgz

cd memcached-2.1.0

?

1

获得 <pre name="code"class="python">php-config目录 whereis <span style="font-family:
Arial, Helvetica, sans-serif;">php-config</span>

phpize./configure
--with-php-config=php-config目录
--with-libmemcached-dir=/usr/local/libmemcached/ --enable-memcached-sasl

?

1

?

1

make

?

1

make install

5.修改对应的配置

增加

?

1

vi /etc/php.d/memcache.ini(之前安装过memcache ) 或者直接放到 php.ini 文件内

?

1

2

extension=memcached.so

memcached.use_sasl =1

最后 重启web服务器 nginx 或者
apache

?

1

2

3

wget http://pecl.php.net/get/memcached-2.1.0.tgz

tar zxvf memcached-2.1.0.tgz

cd memcached-2.1.0

?

1

获得 <pre name="code"class="python">php-config目录

安装php的memcached模块和扩展支持sasl的更多相关文章

  1. centos php 安装memcached 扩展 支持sasl

    1.安装sasl yum install cyrus-sasl-lib.x86_64 yum install cyrus-sasl-devel.x86_64 2.下载libmemcached wget ...

  2. PHP7 下安装 memcache 和 memcached 扩展

    转载自:https://www.jianshu.com/p/c06051207f6e Memcached 是高性能的分布式内存缓存服务器,而PHP memcache 和 memcached 都是 Me ...

  3. linux下php7安装memcached、redis扩展

    linux下php7安装memcached.redis扩展 1.php7安装Memcached扩展 比如说我现在使用了最新的 Ubuntu 16.04,虽然内置了 PHP 7 源,但 memcache ...

  4. php的Memcached模块扩展

    Memcached模块介绍       Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提供动态. ...

  5. php7安装memcache 和 memcached 扩展

    php7安装memcache 和 memcached 扩展 标签(空格分隔): php memcache和memcached区别 memcache:http://pecl.php.net/packag ...

  6. linux上安装php7 memcache扩展 和 安装服务端memcached

    linux上安装memcached不算太困难.唯一让本人感到困难的是 php7的memcache扩展安装.真的蛋疼! 先说安装服务端 memcached 1. 首先安装Libevent事件触发管理器. ...

  7. centos6下安装php7的memcached扩展

    安装php7的memcached扩展 .编译安装libmemcached- wget https://launchpadlibrarian.net/165454254/libmemcached-1.0 ...

  8. 问题 Windows7VMware14安装虚拟机时出现 此主机不支持虚拟化实际模式。需要具备 Intel“VMX 不受限客户机”功能才能在 Intel 处理器上运行此虚拟机。 模块“CPUIDEarly”启动失败。

    问题 Windows7VMware14安装虚拟机时出现 此主机不支持虚拟化实际模式.需要具备 Intel“VMX 不受限客户机”功能才能在 Intel 处理器上运行此虚拟机. 模块“CPUIDEarl ...

  9. linux下给php安装memcached及memcache扩展(转)

    http://kimi.it/257.html (另外的方法)linux安装memcached及memcache扩展一.安装libevent函数库下载地址:http://libevent.org默认被 ...

随机推荐

  1. C语言第二次实验报告

    1.实验题目 题1:11-7 找鞍点(20 分) 一个矩阵元素的"鞍点"是指该位置上的元素值在该行上最大.在该列上最小. 本题要求编写程序,求一个给定的n阶方阵的鞍点    题2: ...

  2. 使用wrk进行性能测试

    1 wrk介绍 wrk是一款现代化的HTTP性能测试工具,即使运行在单核CPU上也能产生显著的压力.它融合了一种多线程设计,并使用了一些可扩展事件通知机制,例如epoll and kqueue. 一个 ...

  3. TCP是什么? 最简单的三次握手说明

    TCP是什么? TCP(Transmission Control Protocol 传输控制协议)是一种面向连接(连接导向)的.可靠的. 基于IP的传输层协议.TCP在IP报文的协议号是6.TCP是一 ...

  4. Spring 数据库连接(Connection)绑定线程(Thread)的实现

    最近在看spring事务的时候在想一个问题:spring中的很多bean都是单例的,是非状态的,而数据库连接是一种有状态的对象,所以spring一定在创建出connection之后在threadloc ...

  5. MYSQL问题解决方案:Access denied for user 'root'@'localhost' (using password:YES)

    这两天在MyEclipse中开发Web项目时,连接MYSQL数据库,出现问题:Access denied for user 'root'@'localhost' (using password:YES ...

  6. MySQL存储过程中declare和set定义变量的区别

    在存储过程中常看到declare定义的变量和@set定义的变量.简单的来说,declare定义的类似是局部变量,@set定义的类似全局变量. 1.declare定义的变量类似java类中的局部变量,仅 ...

  7. ios GCD将异步转换为同步

    在开发中有时需要等网络请求完成之后拿到数据做一些操作,而且有时是同时好几个网络请求同时发起.这时会有对异步操作进行更进一步控制的场景,不单网络请求,有时一些其他本地文件,多张图片处理等可能都会遇到这种 ...

  8. curl错误码说明

    1.得到错误码 $errno=curl_errno($ch); if($errno!=0){ -- } 2.错误码说明 <?php return [ '1'=>'CURLE_UNSUPPO ...

  9. keepalived深度结合lvs_dr模式

    keepalived与dr模式结合 keepalived介绍 keepalived可提供vrrp以及health-check功能,可以只用它提供双机浮动的vip(vrrp虚拟路由功能), 这样可以简单 ...

  10. Event Sourcing pattern

    Event Sourcing pattern Instead of storing just the current state of the data in a domain, use an app ...