Can someone explain a little about this statement about mysqli close function?

Listed here on the mysqli documentation site, one comment says

You should always use mysqli_kill () before mysqli_close () before actually closing and freeing the tcp socket used by PHP. the garbage collection after the execution script and mysqli_close () does not kill the tcp socket on its own. The socket otherwise remains idle for approximately 30 seconds, and any additional attempted download / connection pages would only add to the total number of open tcp connections. This latency does not seem to be configured using PHP settings.

Also, as in this version, mysqli created links cannot be "deactivated", and will continue to accumulate in process memory until the PHP server or the process restarts, essentially requiring mysqli.max_links = -1.

Can anyone explain what this means, and if you need to set mysqli.max_links, how to do it, and if I have to use mysqli_kill ();

+4
source share
1 answer

I do not think rational mysql can be connected via socket to localhost

Be careful using mysqli :: kill before mysqli :: close.

By killing the thread until the connection is actually closed, you leave the connection open! And depending on your max_connections and max_user_connections (the same thing by default), this may lead to the message "Maximum connections reached for ** user".

from: http://www.php.net/manual/en/mysqli.kill.php

+4
source

Source: https://habr.com/ru/post/1333004/


All Articles