Mac 10.13.5 (17F77)
XAMPP 7.1.17
先安装Homebrew
ruby -e "$(curl -fsSL raw.githubusercontent.com/Homebrew/install/master/install)"
使用brew安装需要的依赖
brew install 需要的包名
#如 brew install autoconf
#需要下面四个都要安装
#autoconf redis
#composer wget
编译驱动os文件的的时候需要用到一个php.h文件 貌似必须要xcode
#在App Store 搜索并且安装 Xcode
#如果你之前木有安装建议 卸载重装xampp
下载php_redis安装
curl -O codeload.github.com/phpredis/phpredis/zip/develop
#下载
tar xzvf develop
#解压
cd phpredis-develop
#进入目录
/Applications/XAMPP/xamppfiles/bin/phpize
#目录里运行一下phpize 我之前这里有报错缺少php.h等文件,之前没安装xcode
#解决方案:找到xcode.app文件里的include连接到/Applications/XAMPP/xamppfiles
#如/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
./configure --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config
#设置配置文件
sudo make && sudo make install
#安装编译,中间安装了一些系统文件,所以需要加sudo
vi /Applications/XAMPP/xamppfiles/etc/php.ini
#启动插件,在配置里面修改
extension=redis.so
#添加启动redis
安装think-queue
cd /Applications/XAMPP/xamppfiles/htdocs/moyi/
#进入你网站所在的目录
composer require topthink/think-queue
#使用composer命令安装think-queue
redis-server /usr/local/etc/redis.conf
#开启redis
OK安装全部搞定,重启服务器看看phpinfo确认一下redis启动正常否
在目录下执行
php think queue:work --queue xxxxxxxxx --daemon
#xxxxxxxxx 执行的方法 剩下的如何使用问题 参考下面文章。
#或参考vendor/tophink/think-queue/README
**
参考文章
http://www.thinkphp.cn/code/4425.html
作者:李昊天
官方参考文章
https://github.com/top-think/think-queue/blob/master/README.md
**