使用包 jenssegers/agent
// 重置Agent
\Event::listen('laravels.received_request', function (\Illuminate\Http\Request $req, $app) {
$app->agent->setHttpHeaders($req->server->all());
$app->agent->setUserAgent();
});-
flush/ob_flush/ob_end_flush/ob_implicit_flush:swoole_http_response不支持flush。 -
dd()/exit()/die(): 将导致Worker/Task/Process进程立即退出,建议通过抛异常跳出函数调用栈,Swoole文档。 -
header()/setcookie()/http_response_code():HTTP响应只能通过Laravel/Lumen的Response对象。
$_SESSION
-
Swoole限制了GET请求头的最大尺寸为8KB,建议Cookie的不要太大,不然$_COOKIE可能解析失败。 -
POST数据或文件上传的最大尺寸受Swoole配置package_max_length影响,默认上限2M。
Warning: inotify_add_watch(): The user limit on the total number of inotify watches was reached
-
Linux中Inotify监听文件数默认上限一般是8192,实际项目的文件数+目录树很可能超过此上限,进而导致后续的监听失败。 -
增加此上限到
524288:echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p,注意Docker时需设置启用privileged。