1、官方地址:https://wiki.swoole.com/wiki/page/6.html
2、下载地址:
- https://github.com/swoole/swoole-src/releases
- http://pecl.php.net/package/swoole
- http://git.oschina.net/swoole/swoole
3、下载
wget https://github.com/swoole/swoole-src/archive/v4.4.14.tar.gz
4、解压
sudo tar zxvf v4.4.14.tar.gz
5、查找phpize 并且执行(phpize 命令是用来准备 PHP 扩展库的编译环境的)
sudo find / -name phpize
sudo /usr/local/php-7.2.9/bin/phpize
6、加载配置
sudo ./configure --with-php-config=/usr/local/php-7.2.9/bin/php-config --enable-openssl --enable-http2 --enable-sockets --enable-mysqlnd
7、编译安装
sudo make clean
sudo make
sudo make install
8、配置php.ini
查找 php.ini 在哪里
$ php --ini
Configuration File (php.ini) Path: /usr/local/php-7.2.9/etc
Loaded Configuration File: /usr/local/php-7.2.9/etc/php.ini
编译安装成功后,修改php.ini加入
extension=swoole.so
9、重启php服务
sudo systemctl restart php-fpm.service
10、查看是否成功加载
通过 php -m
或 phpinfo()
来查看是否成功加载了swoole.so