加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 有人可以解释一下这个关于mysqli close函数的陈述吗?

发布时间:2020-12-13 17:05:27 所属栏目:PHP教程 来源:网络整理
导读:其中一条评论说,在 mysqli文档网站上列出 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 k
其中一条评论说,在 mysqli文档网站上列出

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.

有人可以解释这意味着什么,如果应该设置mysqli.max_links,怎么做,如果我应该使用mysqli_kill();

解决方法

我没有发现理性,mysql可以通过localhost上的socket连接

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.

来自:http://www.php.net/manual/en/mysqli.kill.php

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读