easyswoole安装
## 下载
wget https://github.com/swoole/swoole-src/archive/v4.5.4.tar.gz
## 解压到当前目录
tar -zvxf v4.4.16.tar.gz
## cd目录
cd swoole-src-4.4.16/
## 使用phpize创建php编译检测脚本 ./configure
phpize
## 查找php-config地址
find / -name php-config
## 创建编译文件,第一个--with,后面是php的安装路径/bin/php-config ,第二个--enable,是开启swoole的ssl功能
./configure --with-php-config=/usr/bin/php-config --enable-openssl
## 编译swoole并把编译好的文件移动到php的扩展目录(前面的配置php版本的扩展目录) 需要root权限
sudo make && make install
安装时遇到错误:
/data/webroot/swoole-src-4.5.4/include/swoole.h:377:25: fatal error: openssl/ssl.h: No such file or directory#include <openssl/ssl.h>^
compilation terminated.
make: *** [php_swoole.lo] 错误 1
解决:
make clean
yum install openssl-devel
#重新执行./configure
./configure --with-php-config=/usr/bin/php-config --enable-openssl
sudo make && make install
这个时候已经安装成功
需要进入php.ini,在最后面增加上:
extension=swoole.so
成功安装swoole,通过php --ri swoole
查看swoole扩展的信息:
[root@mysql swoole-src-4.5.4]# php --ri swooleswooleSwoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.5.4
Built => Oct 6 2020 14:42:01
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 1.0.2k-fips 26 Jan 2017
pcre => enabled
zlib => 1.2.7
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabledDirective => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
[root@mysql swoole-src-4.5.4]#