编译安装hiredis


wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz
tar zxvf v0.13.3.tar.gz
cd hiredis-v0.13.3

make -j
mkae install
sudo ldconfig


swoole 启用异步Redis客户端
编译swoole时,在configure指令中加入--enable-async-redis


./configure --with-php-config=/usr/local/php/bin/php-config --enable-async-redis
make clean
make -j
make install

==坑
1、swoole 安装后 php -m出现错误:
libhiredis.so.0.13: cannot open shared object file: No such file or director
解决办法:
在/etc/ld.so.conf 加入一行
/usr/local/lib

ldconfig
然后重新编译swoole

最后php --ri swoole 查看async redis client => enabled 恭喜你,成功了

源码编译swoole


#git clone https://gitee.com/swoole/swoole.git
#请下载releases版本的swoole,直接从github主干上拉取最新代码可能会编译不过
wget https://github.com/swoole/swoole-src/archive/v2.1.3.tar.gz

cd swoole

/usr/local/php/bin/phpize #生成configure文件

./configure --with-php-config=/usr/local/php/bin/php-config

make

make install