当前位置:Gxlcms > 数据库问题 > MYSQL Packets out of order. Expected 1 received 56. Packet size=3420216错误

MYSQL Packets out of order. Expected 1 received 56. Packet size=3420216错误

时间:2021-07-01 10:21:17 帮助过:16人阅读

报错信息:

PHP Warning:  Packets out of order. Expected 1 received 56. Packet size=3420216 in /data/bogiang/test/EC/swoole_process.php on line 62

Warning: Packets out of order. Expected 1 received 56. Packet size=3420216 in /data/bogiang/test/EC/swoole_process.php on line 62
PHP Warning:  PDO::query(): MySQL server has gone away in /data/bogiang/test/EC/swoole_process.php on line 62

Warning: PDO::query(): MySQL server has gone away in /data/bogiang/test/EC/swoole_process.php on line 62
PHP Warning:  PDO::query(): Error reading result set‘s header in /data/bogiang/test/EC/swoole_process.php on line 62

Warning: PDO::query(): Error reading result set‘s header in /data/bogiang/test/EC/swoole_process.php on line 62
PHP Fatal error:  Uncaught Error: Call to a member function fetchAll() on bool in /data/bogiang/test/EC/swoole_process.php:63
Stack trace:
#0 [internal function]: {closure}(Object(Swoole\Process))
#1 /data/bogiang/test/EC/swoole_process.php(67): Swoole\Process->start()
#2 {main}
  thrown in /data/bogiang/test/EC/swoole_process.php on line 63

Fatal error: Uncaught Error: Call to a member function fetchAll() on bool in /data/bogiang/test/EC/swoole_process.php:63
Stack trace:
#0 [internal function]: {closure}(Object(Swoole\Process))
#1 /data/bogiang/test/EC/swoole_process.php(67): Swoole\Process->start()
#2 {main}
  thrown in /data/bogiang/test/EC/swoole_process.php on line 63

造成原因:

技术图片
多进程使用同一个mysql链接导致出来的。

为什么会出现这问题:

1.多进程中MYSQL不可以使用同一个链接
2.如果使用需要一个连接池

网上查看了几篇报错的原因:
Thinkphp5框架使用swoole,数据连接报Packets out of order.
PHP MYSQL Packets out of order. Expected 1 received 0. Packet size=
为什么DB连接管理一般不采用IO多路复用?

解决问题:

1、在每个进程里进行链接mysql
2、使用连接池,避免这个问题
php搭建mysql连接池

MYSQL Packets out of order. Expected 1 received 56. Packet size=3420216错误

标签:call   head   mys   pdo   错误   inf   www   error   reading   

人气教程排行