"MySQL server has gone away" in mysqli

mysql

Solution

There is a mysqli_ping method for this, as well:

https://www.php.net/manual/en/mysqli.ping.php

However, in my experience, ping was not needed. All I had to do was add `mysqli.reconnect = "1"` to my php.ini.

Ref. check if mysql connection is valid

Problem

My web threw the error "MySQL server has gone away". I google it, find a method that use `mysql_ping` function, but I use extension mysqli, not mysql. How can I fix this problem?

Original source

Related problems