[v1.4.3] frequent Warnings for "Packets out of order" from the mysqli driver

3,165 views
Skip to first unread message

Sanjay Bhandari

unread,
Mar 12, 2022, 10:22:55 PM3/12/22
to Easy!Appointments - Support Group
I keep getting these errors:

===========================================
A PHP Error was encountered

Severity: Warning

Message: Packets out of order. Expected 1 received 0. Packet size=145

Filename: mysqli/mysqli_driver.php

Line Number: 203

===========================================

Google says to try and set PDO::ATTR_EMULATE_PREPARES to true, but that didn't help.

Some say this is because of a coding issue where the database cursor is not closed correctly.

Anyone else getting this?

Alex Tselegidis

unread,
Mar 16, 2022, 3:40:49 AM3/16/22
to Easy!Appointments - Support Group
Hello! 

This is a server configuration issue that can become very tricky under certain circumstances. 

You cannot set PDO::ATTR_EMULATE_PREPARES, because the underlying framework (CodeIgniter) does not use PDO for the database connection but the mysql interface. 

Try these steps: 

  • Ensure that the MySQL server instance is properly running and that is still accessible by the server that issues the call: check the port availability (3306 being the default one, unless you changed it) and ensure that there are no firewalls, proxies, TCP filters, port-scanners or any other software that might affect it.
  • There’s a good chance that the server is dropping an incorrect or too large packet sent by the client: when this happens, MySQL usually assumes that something has gone wrong with the client and shuts down the connection. To fix that, check the max_allowed_packet variable value and set it to a very high value (such as max_allowed_packet=2G  ). Based from our experience this is the most common scenario, so it can be wise to try this before anything else.
  • The issue might be due to the fact that the server timed out and closed the connection. Check the wait_timeout MySQL variable value and ensure it’s large enough: once done, check the interactive_timeout as well. Be aware that the default value for both of these variables is 28800 seconds in MySQL 5.7+.







Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!


Sanjay Bhandari

unread,
Mar 16, 2022, 8:34:54 PM3/16/22
to Easy!Appointments - Support Group
Thanks! Will try. Although, it seems strange to me that the application would be exceeding the default packet size of 64M or timeout of 28800 seconds. But will try.

Alex Tselegidis

unread,
Mar 21, 2022, 5:56:55 AM3/21/22
to Easy!Appointments - Support Group
I find it a bit strange too, as in the past this was never an issue and I hadn't changed anything in the app the last years that could really affect your server in such a way. 

So my guess is that there's some external source that may have to do with this. 

Out of curiosity, which MySQL version are you using? 






Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!



Marina D'Agata

unread,
Oct 27, 2022, 6:15:29 AM10/27/22
to Easy!Appointments - Support Group
Yes I'm.
I get the error in backend (admin) and public pages, everywhere.
It's very frustrating.

A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): MySQL server has gone away
Filename: mysqli/mysqli_driver.php
Line Number: 201

Thanks in advance
Marina

Alex Tselegidis

unread,
Nov 2, 2022, 9:03:27 AM11/2/22
to Easy!Appointments - Support Group
Hello! 

This article provides the solution for the "MySQL server has gone away" problem: 


Alex Tselegidis, Easy!Appointments Creator
Need a customization? Get a free quote!



Reply all
Reply to author
Forward
0 new messages