1.安装 gcc gcc-c++ 4.8 (swoole 依赖)

https://my.oschina.net/u/583362/blog/682123
安装 gcc gcc-c++ 4.8 

yum --enablerepo=testing-devtools-2-centos-6 install devtoolset-2-gcc devtoolset-2-gcc-c++
yum -y install devtoolset-2-gcc-gfortran devtoolset-2-binutils
ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/

2.安装 swoole 扩展

git clone git@github.com:swoole/swoole-src.git
cd swoole-src
/usr/local/php7.3.9/bin/phpize
./configure --enable-openssl --with-php-config=/usr/local/php7.3.9/bin/php-config CFLAGS=-fPIC
make && sudo make install

php.ini 添加 swoole 扩展

vi php.ini

extension=swoole.so

ps:

1.swoole curl
https://segmentfault.com/a/1190000019391369

2.defer特性只支持并发收取响应结果, 正如示例代码所示, 创建连接和数据的发送, 仍是串行的
https://wiki.swoole.com/wiki/page/604.html

3.channel + 子协程
https://wiki.swoole.com/wiki/page/p-coroutine_channel.html