安装 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
vscode 插件开发 vscode 插件开发
插件初始化安装Yeoman和VS Code脚手架npm install -g yo generator-code生成项目模版yo code插件开发https://marketplace.visualstudio.com/items?itemName=hubcarl.vscode-easy-pl...
2019-10-20 sky
Next 
常见问题 常见问题
Babel 快速升级问题为了更方便升级 Babel7, 同时尽量减少配置且无需安装 @babel 依赖,@easy-team 模式直接内置Babel 7 的相关依赖,只需要把 easywebpack 依赖模式改成 @easy-team/easywebpack 模式,如果代码中直接依赖了也请一并...
2019-10-20 sky