1:下载安装hiredis库。
wget https://github.com/redis/hiredis/archive/master.zip
unzip master.zip && cd hiredis-master
make && make install
ldconfig
2:重新安装swoole
wget https://github.com/swoole/swoole-src/archive/v2.2.0.tar.gz
tar -zxvf v2.2.0.tar.gz
cd swoole-src-2.2.0/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-async-redis
在编译时增加--enable-async-redis
来开启此功能
make && make install
php --ri swoole
[root@iZuf61 swoole-src-2.2.0]# php --ri swoole
swoole
swoole support => enabled
Version => 2.2.0
Author => tianfeng.han[email: [email protected]]
coroutine => enabled
epoll => enabled
eventfd => enabled
timerfd => enabled
signalfd => enabled
cpu affinity => enabled
spinlock => enabled
rwlock => enabled
async redis client => enabled
async http/websocket client => enabled
Linux Native AIO => enabled
pcre => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
Directive => Local Value => Master Value
swoole.aio_thread_num => 2 => 2
swoole.display_errors => On => On
swoole.use_namespace => On => On
swoole.use_shortname => On => On
swoole.fast_serialize => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608
当出现async redis client => enabled
协程Redis客户端 则为启用了。