Copy link to clipboard
Copied
hi,
i created a dynamic site with dreamweaver however i only ahve about 10 users logged in at any one time however they are getting the too many connections error in connection file thrown up.
i checked with the host who said it has a max of 25 connections and this is more than enough.
i read a bit on the net and say that you can just remove the pconnect that the connection file has.
why does dreamweaver create the connection file like this and what are the advantages/disadvantages of having the pconnect removed?
i have currently this line in my connection file:
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
do i just change it to this:
$conn = mysql_connect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
?
many thanks
Short answer is "Yes">
mysql_pconnect() leaves the connection open for future use from the same user. This is more efficient in some cases. In other cases, obviously not so. It would seem that Adobe made an assumption.
From W3 Schools: "The connection will not be closed when the execution of the script ends (mysql_close() will not close connection opened by mysql_pconnect()). It will stay open for future use."
Barry
Copy link to clipboard
Copied
Short answer is "Yes">
mysql_pconnect() leaves the connection open for future use from the same user. This is more efficient in some cases. In other cases, obviously not so. It would seem that Adobe made an assumption.
From W3 Schools: "The connection will not be closed when the execution of the script ends (mysql_close() will not close connection opened by mysql_pconnect()). It will stay open for future use."
Barry
Copy link to clipboard
Copied
thanks barry,
so does dreamweaver create the pconnect by default?
i am guessing that is what was throwing the error "too many connections" should this resolve this now by changing?
also one last thing if you dont mind.
where should i add mysql_close() ? should this be in my user_logout.php page?
many thanks again for your help.
Copy link to clipboard
Copied
I checked some code that I have and I would have to say that it appears that DW is using pconnect by default.
Resources are freed when the the script ends with a non-persistent connection, so you technically don't need the close().
Barry.
Copy link to clipboard
Copied
So what actually determines this limit, the number if allowed connections? Is it a default setting in a MySQL installation, and can it be set by the hosting provider? (or yourself if you're running a local server).
Is it related to the number of allowed connections to the site itself in a shared environment? I recall a conversation with <a particular hosting provider> and that number 25 came up but in the context of connections to the site, databases weren't even mentioned. it's possible they were confused about this, because it was the first time I had ever heard of such a limitation placed on a shared account, or it's possible that they were just trying to sell me a virtual dedicated plan, which was what I called to ask. about in the first place.
Good topic and info guys, much appreciated.
Note: it's interesting that it's always been MS Access that had the bad rap for this issue, turns out they ain't the only one. Not that I'd ever again actually use it for a web database, but you know what I mean.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more