Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用laravel brainsocket时内存耗尽_Php_Sockets_Laravel_Websocket - Fatal编程技术网

Php 使用laravel brainsocket时内存耗尽

Php 使用laravel brainsocket时内存耗尽,php,sockets,laravel,websocket,Php,Sockets,Laravel,Websocket,当我使用php artisan brainsocket:start--port=8080启动套接字服务器时,当用户逐渐增长时,我的内存总是耗尽,套接字服务器将停止 PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 33151019 bytes) in /alidata/www/wcketbtn/vendor/react/stream/src/Buffer.php on li

当我使用
php artisan brainsocket:start--port=8080
启动套接字服务器时,当用户逐渐增长时,我的内存总是耗尽,套接字服务器将停止

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 33151019 bytes) 
in /alidata/www/wcketbtn/vendor/react/stream/src/Buffer.php on line 118
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException",
"message":"Allowed memory size of 134217728 bytes exhausted (tried to allocate 33151019 bytes)",
"file":"\/alidata\/www\/wketbtn\/vendor\/react\/stream\/src\/Buffer.php","line":118}}
随着用户的增长,我使用
htop
检查内存使用情况:

 CPU[||||||||||||||||||||||||||||||||||||||||||||||||||||99.3%]     Tasks: 64, 57 thr; 2 running
  Mem[||||||||||||||||||||||||||||||||||||||||||||||||636/994MB]     Load average: 1.00 0.68 0.37 
  Swp[                                                    0/0MB]     Uptime: 123 days(!), 19:05:51

  PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
28858 root       20   0  202M 91680  6776 R 97.0  9.0  5:54.93 php artisan brainsocket:start --port=8080
29054 root       20   0 24508  2184  1448 R  1.0  0.2  0:00.06 htop
所以我使用
php-d memory\u limit=512M artisan brainsocket:start--port=8080
,但仍然会耗尽内存

我不知道哪种代码会逐渐增加我的内存使用量,以及如何限制内存使用量或取消设置内存使用量。我该怎么办

或者,我如何编写一个shell脚本来监视套接字服务器,当它停止时,重新启动它(运行
php-artisan-brainsocket:start--port=8080
)。

和函数是您的朋友

尝试将它们的输出保存在PHP脚本的其他各个部分之后的某个地方,您很快就会发现问题所在

我还要检查一下你的
内存限制=512M
是否正常工作。当您设置该设置时,错误代码是什么样子的?它是否仍然显示~134000000字节已用完