安装 PHP 5.6

安装memcache

  • brew info memcached
  • brew search memcache
  • brew install memcached

libmemcached是客户端,
memcached 是服务器

  • brew services start memcached
  • telnet localhost 11211

PHP memcached 扩展

  • http://pecl.php.net/package/memcache
  • tar xzf memcache-2.2.7.tgz
  • phpize
  • brew list zlib
  • ./configure –with-zlib-dir=/usr/local/Cellar/zlib/1.2.11
  • make
  • sudo make install
  • extension=/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/memcache.so

redis

https://www.jianshu.com/p/32f2cb1bb96f

  • brew install redis
  • 允许接受客户端的连接 修改 usr/local/etc/redis.conf 的 daemonize no 为 daemonize yes
  • sudo redis-server /usr/local/etc/redis.conf
  • sudo redis-cli
  • redis-cli shutdown
  • ps aux | grep redis
  • brew services start redis

php redis 扩展

https://github.com/phpredis/phpredis

brew services restart apache2

代码检测

<?php
$memcache = new Memcache; 
$memcache->connect('localhost', 11211) or die ("Could not connect"); 
$memcache->set('key', '123456');       
$get_value = $memcache->get('key');   
echo $get_value;

$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$redis->set('redis','123456');
echo  $redis->get('redis');

echo phpinfo();
?>

Author: sky
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source sky !
 Previous
Webpack 热更新实现原理分析 Webpack 热更新实现原理分析
概述在使用 Webpack 构建开发期时,Webpack 提供热更新功能为开发带来良好的体验和开发效率。Webpack 热更新可以做到页面无刷新局部更新能力。Webpack 热更新机制相比传统的直接自动刷新浏览器,可以保持元素当前状态,特别是在编写 css 样式调整布局的时候优势明显,不用反复...
2020-04-18 sky
Next 
npm 常用命令 npm 常用命令
原文: https://hubcarl.github.io/blog/2018/03/22/npm/npm 初始化 package.jsonnpm initnpm install 安装npm installnpm instal同时安装 package.json 配置 dependencies 和...
2020-04-18 sky