swoole 异步redis 客户端
1、编译安装 hiredis( v0.13.3 )
wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz
tar -zxvf v0.13.3.tar.gz
make
make install
sudo ldconfig
2、启用异步Redis客户端
./configure --with-php-config=/usr/bin/php-config --enable-async-redis
make clean
make -j
sudo make install
遇到的坑及解决方案
环境: CentOS release 6.5 + php 5.6 ,提示
- libhiredis.so.0.13: cannot open shared object file: No such file or directory in Unknown on line 0
解决方案:
hiredis 安装后,默认配置到 /usr/local/lib 目录下,需
确保你的/etc/ld.so.conf的配置里有该路径。
cd /etc/ld.so.conf.d
vim swoolehiredis.conf
#添加路径
/usr/local/lib
再次执行 第2步 启用异步redis客户端
3、验证安装是否成功
php --ri swoole
结果:(async redis client => enabled)
swoole
swoole support => enabled
Version => 2.0.9
Author => tianfeng.han[email: mikan.tenny@gmail.com]
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.fast_serialize => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608