|
| Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more. |
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Posts: n/a
|
mySQL temporary tables, persistent connections, and PHP
I understand SQL but I don't pretend to understand everything about how Apache, PHP and mySQL are integrated. In the context of Powweb shared hosting, accessing mySQL through PHP, are the following statements correct?
1) There are no persistent mySQL connections available from PHP, although it does no damage to request one. 2) Connections will always be dropped at the end of each PHP CGI request. 3) The lifetime of temporary tables is, therefore, bounded by the creating PHP CGI request. 4) Connections will never be dropped (barring truly unusual circumstances) during a PHP CGI request. If statement 1 is false, is there any way to distinguish whether mysql_pconnect has returned a persistent connection or opened a new one? I'm pondering whether any mySQL connection-associated entities (like temporary tables and transactions) can span a redirect, and it looks like the answer is "no". Comments? Corrections? |
|
|
#2 |
|
foo
Join Date: Jan 2003
Location: Seattle-ish
Posts: 2,597
Reputation: 106
|
AFAIK, that is all correct. I've never tried using pconnect on powweb, so I don't know if would function just as well.
__________________
webhead.cc |
|
|
|
|
#3 |
|
Posts: n/a
|
Thank you, Pig.
mysql_pconnect works OK. It just behaves like mysql_connect in this environment. |
|
|
#4 |
|
Posts: n/a
|
Unfortunately mysql_pconnect does not operate in exactly the same way as mysql_connect and can give rise to a number of problems on shared servers, the main one being error 1040.
This is caused by the different behaviour of the way in which the connection is closed - mysql_connect disconnects at the end of the running script - mysql_pconnect disconnects after a time-out period unless specifically disconnected by the running script. Since most scripts can never guarantee that they will be run to the last in the series, many mysql_pconnect connections are left open until the time-out period has elapsed - not a good idea in a shared environment as they hog connection resources and even on a moderately used server can cause '1040 - too many connections' errors. |
|
|
#5 | |
|
Join Date: Feb 2003
Location: no
Posts: 131
Reputation: 17
|
Quote:
Agreed, From my experience I don't believe that Powweb supports persistent connections and thus operate the same as a regular connection disconnecting at the end of script execution. - Lucas |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|