Use mysql_pconnect () or mysql_connect ()? How to solve
Source: Internet
Author: User
Use mysql_pconnect () or mysql_connect ()? Mysql_pconnect () & nbsp; and & nbsp; mysql_connect () & nbsp? Many of my views use & nbsp; my use mysql_pconnect () or mysql_connect ()?
The difference between mysql_pconnect () and mysql_connect () is clear to me. which one do you usually use? Many of my views use mysql_connect (). does mysql_pconnect () have any negative impact?
------ Solution --------------------
Generally, mysql_connect is used for web sites. a single user does not frequently call the database and there is no need to keep the connection. In addition, the number of connections to mysql is also limited. Generally, there are 1000 connections, when a user does not release a connection for a long time, it is easy to cause the mysql connection to be full, so that other users cannot access the database, and then cannot access the website normally. I just learned this. I used to use mysql_pconnect and Khan.
------ Solution --------------------
Generally, mysql_connect is used for web sites. a single user does not frequently call the database, and there is no need to maintain the connection.
----------------------------------------------
Not very agree, unless you generate HTML
------ Solution --------------------
It is better to use mysql_connect by default.
The connect function in the dbstuff class of discuz is a function with parameters, and then select it when calling it.
The default value is mysql_connect.
Generally, the database will not be accessed frequently and repeatedly. In fact, if the database is not large in size, the pressure on connecting to the database is not great.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service