swoole 使用 异步redis的前置条件
- redis 服务
- hiredis库
- 编译 swoole 需要加入 -enable-async-redis
安装 redis
下载 redis 地址: https://redis.io
cd ~/Downloads tar -zxvf redis-4.0.9.tar.gz cd redis-4.0.9 make
启动服务:
cd redis-4.0.9/src ./redis-server
hiredis 地址: https://github.com/redis/hiredis/releases
安装 hiredis
cd ~/Downloads wget https://github.com/redis/hiredis/archive/v0.13.3.zip unzip v0.13.3.zip cd hiredis-0.13.3 make -j sudo make install sudo ldconfig
重新编译 hiredis
cd ~/Downloads/swoole/ ./configure --with-php-config=/home/misswell/soft/php/bin/php-config --enable-async-redis make clean make -j make install ... Installing shared extensions: /home/misswell/soft/php/lib/php/extensions/no-debug-non-zts-20170718/ Installing header files: /home/misswell/soft/php/include/php/
php -m
命令查看 Swoole 是否开启成功
php --ri swoole
命令查看 Swoole 异步是否安装成功 async redis client =>enable
./configure –with-php-config=/usr/local/php/bin/php-config –enable-sockets –enable-openssl –with-openssl-dir=/opt/openssl/ –enable-http2 –enable-async-redis