Z1. Notices - swooletw/laravel-swoole GitHub Wiki
Notices
- Please reload or restart the swoole_http_server after released your code. Because the Laravel program will be kept in memory after the swoole_http_server started. That's why the swoole_http_server has high performance.
- Never use
dd(), exit() or die() function to print your debug message. It will terminate your swoole worker unexpectedly. Hint: you may also use Ignition's ddd() function to reproduce the experience of dd() function
global and static variables needs to be destroyed(reset) manually.
- Infinitely appending element into static/global variable will lead to memory leak.
// Some class
class Test
{
public static $array = [];
public static $string = '';
}
// Controller
public function test(Request $req)
{
// Memory leak
Test::$array[] = $req->input('param1');
Test::$string .= $req->input('param2');
}
flush()/ob_flush()/ob_end_flush()/ob_implicit_flush() are not supported in swoole response.
- Don't use
header()/setcookie()/http_response_code() in your response, only return in illuminate response.
- Request header can not exceed
8 KB. This is restricted by Swoole.
- By default the max size of POST data/file is
10 MB which is restricted by package_max_length in Swoole.
- You should have basic knowledge about multi-process programming and Swoole. If you still write your code with traditional php concepts, your app might have unexpected bugs.
← Nginx-Configuration | Issues-Guideline →