skip to Main Content

I’m using xampp as a dev server and it has worked great for weeks. I had to reboot the machine xampp is installed on today and now, this evening, I am getting errors (warnings) when trying to do the exact things that worked yesterday. I get:

Warning: Packets out of order. Expected 0 received 1. Packet size=23 in C:xampphtdocsproject_mgrapiconfigdb_connect.php on line 15

Warning: mysqli::__construct(): Error while reading greeting packet. PID=9000 in C:xampphtdocsproject_mgrapiconfigdb_connect.php on line 15

Warning: mysqli::__construct(): (HY000/2006): MySQL server has gone away in C:xampphtdocsproject_mgrapiconfigdb_connect.php on line 15
Connect failed: MySQL server has gone away

I can connect to the mysql server. I get this when printing out the mysqli connection object:

mysqli Object
(
    [affected_rows] => 0
    [client_info] => mysqlnd 7.4.19
    [client_version] => 70419
    [connect_errno] => 0
    [connect_error] => 
    [errno] => 0
    [error] => 
    [error_list] => Array
        (
        )

    [field_count] => 0
    [host_info] => 127.0.0.1 via TCP/IP
    [info] => 
    [insert_id] => 0
    [server_info] => 5.5.5-10.4.19-MariaDB
    [server_version] => 100419
    [sqlstate] => 00000
    [protocol_version] => 10
    [thread_id] => 473
    [warning_count] => 0
)

phpMyAdmin seems to work fine as well. All the data is there and mysql is definitely running.

I haven’t upgraded or changed xampp in any way. This is baffling. What changed?!

Reading online, I have tried increasing max_allowed_packet, to no avail. I have rebooted the machine again. Restarted mysql several times. Nothing works. What else can I try???

Thanks!

2

Answers


  1. Chosen as BEST ANSWER

    The problem came when I pulled a chunk of code out of a function (Function A) and made another function (Function B) out of it to clean it up and, ironically, prevent errors.

    What I didn't catch was the functions had a mutual dependency. Function A was calling B, and B was calling A. Neither could return anything without the other. I think this bound up the system and killed it.

    I changed B to be independent of A and now everything is working again.


  2. Try running this query in your MySQL to adjust the size of the max_allowed_packet or adjust the net_read_timeout;

    SET GLOBAL max_allowed_packet=268435456;
    SET GLOBAL net_read_timeout = 1000; 
    

    MySQL server has gone away error means that MySQL server (mysqld) timed out and closed the connection.
    Check this here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search