安装swoole 运行报错
Error at file[/home/huanggang/var/www/LTalk-swoole-1.0/vendor/easyswoole/easyswoole/src/Core/Swoole/Coroutine/Client/Redis.php] line[30] message:[Uncaught Error: Class 'Swoole\Coroutine\Redis' not found in /home/huanggang/var/www/LTalk-swoole-1.0/vendor/easyswoole/easyswoole/src/Core/Swoole/Coroutine/Client/Redis.php:30
找不到异步reids,这时需要重新编译swoole支持redis。
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
如果还没有 async redis client => enabled
需要在执行
vi ~/.bash_profile
在最后一行添加 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
source ~/.bash_profile
再次编译 即可
网友评论