下載https://github.com/swoole/swoole-src/tree/master

image.png
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make -j4
sudo make install

image.png
配置php.ini
把剛剛裝的redis和swoole擴展加入

image.png
然后檢查
php -m
image.png
接下來重啟服務
sudo php-fpm restart
sudo chmod -R 777 /var/run/php //502報錯運行這行

image.png

image.png