1、swoole官網(wǎng)下載地址(php8以上下載5+版本序仙,php7安裝4+,4.8.11)
https://www.swoole.com/download
2鲁豪、解壓swoole 壓縮包到存放php資源包的位置潘悼,
tar -xvf swoole-src-4.8.11.tar.gz
3洋丐、進(jìn)入swoole目錄并phpize編譯
phpize
Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718
4、進(jìn)行配置 ./configure
./configure
[root@localhost swoole-4.8.9]# ./configure
checking for grep that handles long lines and -e... /usr/bin/grep
...........
configure: error: Cannot find php-config. Please use --with-php-config=PATH
有錯誤:configure: error: Cannot find php-config. Please use --with-php-config=PATH
需要指定PHP的配置文件路徑挥等,重新進(jìn)行配置友绝,這個目錄是自己的,每次可能不一樣肝劲,看php版本
./configure --with-php-config=/www/server/php/74/bin/php-config
5迁客、進(jìn)行編譯安裝
sudo make && sudo make install
6、配置swoole擴展
編輯php.[ini文件]辞槐,然后在里面添加一行擴展開啟
[swoole]
extension=swoole
7掷漱、重啟php
輸入命令 php --ri swoole ,如果輸出了 Swoole 的擴展信息就說明你安裝成功了榄檬!