PowWeb Forums - The Perfect Community for the Perfect Host  

Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more.

Go Back   PowWeb Community Forums > The PowWeb Platform > MySQL
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Closed Thread
 
Thread Tools Search this Thread
Old 1-10-05, 03:55 AM   #1
sfriedberg
 
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?
 
Old 1-10-05, 09:24 AM   #2
Pig
foo
 
Pig's Avatar
 
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
Pig is offline  
Old 1-13-05, 07:40 AM   #3
sfriedberg
 
Posts: n/a
Thank you, Pig.

mysql_pconnect works OK. It just behaves like mysql_connect in this environment.
 
Old 3-28-05, 06:00 AM   #4
ianmkerr
 
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.
 
Old 3-29-05, 04:34 AM   #5
Coolviper1985
 
Coolviper1985's Avatar
 
Join Date: Feb 2003
Location: no
Posts: 131
Reputation: 17
Quote:
mysql_pconnect works OK. It just behaves like mysql_connect in this environment.


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
Coolviper1985 is offline  
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 10:35 PM.


Contents ©PowWeb, Inc. ~ vBulletin, Copyright © 2000-2007 Jelsoft Enterprises Limited.