php connection pooling mysql(php 连接池 mysql)
问题描述
我打算使用 MYSQL.是否有可用的连接池扩展?或者连接的正常做法是什么?是不是到处都用这个...
I am planning to use MYSQL. Is there a connection pooling extension available? Or what is the normal practice for connection? Is this the one used in every where...
mysqli_connect("localhost", "xxx", "xxx", "test");
人们是否只使用普通的 mysql_connect 或 pconnect..?pconnect 有多好,我应该为 PConnect 做哪些设置?
Do people use just normal mysql_connect or pconnect..? How better is pconnect and what setting should I do for PConnect?
推荐答案
你用过 mysql_pconnect() 吗?mysql_pconnect() 的行为与 mysql_connect() 非常相似,但有两个主要区别.
have you ever used mysql_pconnect() ?
mysql_pconnect() acts very much like mysql_connect() with two major differences.
首先,在连接时,该函数将首先尝试查找已使用相同主机、用户名和密码打开的(永久)链接.如果找到,将返回它的标识符,而不是打开新连接.
First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection.
其次,脚本执行结束时不会关闭与SQL服务器的连接.相反,该链接将保持打开状态以供将来使用(mysql_close() 不会关闭由 mysql_pconnect() 建立的链接).
Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()).
因此这种类型的链接被称为持久"
This type of link is therefore called 'persistent'
检查它这里
这篇关于php 连接池 mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:php 连接池 mysql
				
        
 
            
        - SoapClient 设置自定义 HTTP Header 2021-01-01
 - Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
 - 带有通配符的 Laravel 验证器 2021-01-01
 - Mod使用GET变量将子域重写为PHP 2021-01-01
 - Laravel 仓库 2022-01-01
 - 从 PHP 中的输入表单获取日期 2022-01-01
 - 如何定位 php.ini 文件 (xampp) 2022-01-01
 - PHP Count 布尔数组中真值的数量 2021-01-01
 - 没有作曲家的 PSR4 自动加载 2022-01-01
 - 正确分离 PHP 中的逻辑/样式 2021-01-01
 
				
				
				
				