Listed here on the mysqli documentation site, one of the comments says
You should always use mysqli_kill() function before mysqli_close() to actually close and free up the tcp socket being used by PHP. Garbage collection after script execution nor mysqli_close() do not kill the tcp socket on their own. The socket would otherwise remain in 'wait' state for approximately 30 seconds, and any additional page loads/connection attempts would only add to the total number of open tcp connections. This wait time does not appear to be configurable via PHP settings.
Also as开发者_如何转开发 of this version, mysqli created links cannot be "deactivated", and will continue to accumulate in process memory until the PHP server or process is restarted, essentially making mysqli.max_links = -1 required.
Could someone explain what this means, and if mysqli.max_links should be set, how so, and if i should be using mysqli_kill();
I don't found that rational, mysql can be connected via socket on localhost
Be careful using mysqli::kill before mysqli::close.
Killing the thread before actually closing the connection will leave the connection open! And depending on your max_connections and max_user_connections (by default the same), this could result in a "Max connections reached for ** user" message.
from : http://www.php.net/manual/en/mysqli.kill.php
精彩评论