![]() ![]() Its principle is: after mysql_query execution, the return value is detected. Regular execution of mysql_ping does not solve the problem, for example, the connection is closed just after the mysql_ping test has been performedĬapture the error code, disconnect and reconnect The reason is that mysql_ping needs to actively detect connections, resulting in additional consumption. Many people have put forward the scheme of mysql_ping, which carries out connection detection or timing connection detection every time mysql_query. So the PHP program needs to be disconnected and reconnected. If the program can't handle it, it directly encounters a fatal error and exits. If mysql_query is still executed, an error of MySQL server has gone away will be reported. In other cases, execute kill process in the MySQL CVM to kill a connection, and restart the MySQL CVM.Īt this point, the MySQL connection in the PHP program fails. When the PHP program encounters an idle period, there is no MySQL query for a long time, and MySQL-Server will also cut off the connection to reclaim resources. MySQL-Server will automatically cut off the connection within a certain period of time. The reasons for instability are as follows: In the cli environment, the PHP program needs to run for a long time, and the TCP connection between the client and the MySQL CVM is unstable. This article mainly introduces the PHP program mysql reported mysql has gone away error reasons and solutions, the content of the article is carefully selected and edited by the author, with a certain pertinence, for everyone's reference significance is still relatively great, the following with the author to understand the PHP program mysql reported mysql has gone away error reasons and solutions. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |