PHP 之Swoole
swoole发布已很长时间了, 工作中一直没有业务可以用到, 今天算是在cento6.8上入门测试一下:
git下载: https://github.com/swoole/swoole-src
使用2.0版本: git checkout 2.0
安装 : 如果你只有一个版本的php, 可以使用pecl instll swoole, 这样更快一些, 编译安装 :
/opt/php71/bin/phpize
./configure --with-php-config=/opt/php71/bin/php-config
make && make install
配置php.ini, 添加
[swoole]
extension = swoole.so
5. 检查: /opt/php71/bin/php -m
以上正常, 如遇错误可以查看官方常见错误: https://wiki.swoole.com/wiki/page/438.html
1. Mac 下使用 pecl install swoole; 报错 fatal error: 'openssl/ssl.h' file not found
解决方法:
sudo ln -s /usr/local/opt/openssl/include/openssl /usr/include
2. Mac 下使用 pecl install swoole; 报错 fatal error: 'hiredis/hiredis.h' file not found
解决方法: brew install hiredis
然后继续编译