有人可以解释一下有关mysqli close function的声明吗? [英] Could someone explain a little about this statement about mysqli close function?

查看:51
本文介绍了有人可以解释一下有关mysqli close function的声明吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其中之一在mysqli文档站点上列出,其中的注释说

Listed here on the mysqli documentation site, one of the comments says

您应该始终使用mysqli_kill() mysqli_close()之前的函数 实际关闭并释放tcp PHP正在使用的套接字.垃圾 脚本执行后收集也不 mysqli_close()不会杀死tcp 自行插座.插座会 否则保持等待"状态 大约30秒,以及任何 额外的页面加载/连接 尝试只会增加总数 打开的TCP连接数.这 等待时间似乎不是 可通过PHP设置进行配置.

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.

也是该版本的mysqli 创建的链接无法停用", 并将继续积累 处理内存,直到PHP服务器或 进程实际上已重新启动 要求mysqli.max_links = -1.

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();

Could someone explain what this means, and if mysqli.max_links should be set, how so, and if i should be using mysqli_kill();

推荐答案

我没有发现合理的mysql可以通过本地主机上的套接字进行连接

I don't found that rational, mysql can be connected via socket on localhost

在mysqli :: close之前请小心使用 mysqli :: kill .

在实际关闭连接之前杀死线程将使连接保持打开状态!并且取决于您的max_connections和max_user_connections(默认情况下相同),这可能会导致显示" * *用户已达到最大连接数"消息.

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/zh/mysqli.kill.php

这篇关于有人可以解释一下有关mysqli close function的声明吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆