1. 下載swoole
http://pecl.php.net/package/swoole
2. 安裝swoole擴(kuò)展
tar zxvf swoole-4.4.12.tgz
cd swoole-4.4.12
phpize
./configure --with-php-config=/usr/local /php/bin/php-config
make && make install
echo "extension=swoole.so" >> /usr/local/php/etc/php.ini
/etc/init.d/php-fpm restart
3. 查看是否安裝成功
php -m | grep swoole
4. Laravel6 安裝 swoole
composer require swooletw/laravel-swoole
添加服務(wù)提供者到config/app.php
'providers' => [
SwooleTW\Http\LaravelServiceProvider::class,
],
5. 發(fā)布(不發(fā)布的話storage下的log會(huì)沒日志 )
php artisan vendor:publish --tag=laravel-swoole
6. 安裝成功,運(yùn)行成功

圖片.png
7. 查看版本或幫助
php artisan help swoole:http # 查看幫助
php artisan swoole:http start # 啟動(dòng)服務(wù)
php artisan swoole:http restart # 重啟服務(wù)
php artisan swoole:http reload # 熱更新swoole服務(wù)
php artisan swoole:http infos # 查看版本

圖片.png
swoole 使用確實(shí)爽速度快了好多倍, 之前需要一百多毫秒的一個(gè)接口現(xiàn)在一個(gè)接口8,9 毫秒就搞定了。
相關(guān)網(wǎng)頁(yè): https://github.com/swooletw/laravel-swoole
swoole + inotify 熱更新
相關(guān)web
1. 安裝包
http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz
2. 使用方法及測(cè)試方法
https://blog.csdn.net/zz_aiytag/article/details/107826135
3. centos7.2 rsync + inotify 安裝使用實(shí)時(shí)備份
https://blog.csdn.net/weixin_39963973/article/details/78551926
4 . 報(bào)錯(cuò)處理
error while loading shared libraries: libinotifytools.so.0: cannot open shared object file
https://blog.csdn.net/wangxin6722513/article/details/44218893
安裝shell
#!/bin/bash
cd /tmp
wget http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz
tar zxvf inotify-tools-3.14
cd /tmp/inotify-tools-3.14
./configure –prefix=/usr/local/inotify
make && make install
echo "/usr/lib64/mysol" >> /etc/ld.so.conf
ldconfig
export LD_LIBRARY_PATH=/usr/local/inotify/lib:$LD_LIBRARY_PATH
測(cè)試腳本 /tmp/demo.sh , 當(dāng)/tmpsrcdir 有變化 時(shí)就會(huì)執(zhí)行
#!/bin/bash
srcdir=/tmp/srcdir
inotifywait -rq --timefmt '%d/%m/%y-%H:%M' --format '%T %w%f' -e modify,create,attrib ${srcdir} \
| while read file
do
echo "${file} is notified!"
done