[PHP-DB] Close Postgresql Database Connection Problem !

2001-08-15 Thread Perrin

Hi !

There are some confusion for me. Could you help me ?
Suppose I write a program by php and connect the postgresql database through web page. 
 If I use the providing API from PHP connect to postgresql database,  like that 
pg_connect();

== $connection  = pg_connect($constr user='$USER' password='$PW');

Actually It should be closed the connection after access finished, like that 
pg_close();

== pg_close($connection);

But if the user force to close the web page that means have not close the connection. 
I want to ask the connection will be closed by Apache Server automatic ? or when user 
closed the web page the connection will be closed at the same time ? If the connection 
have not been closed automatic. So the Apache Server will keep the connect port 
forever ?
Actually the connection port handle by Apache Server or PHP ?

Details:
=
PHP 4.0.3pl1
PostgresSQL 7.0.3
Apache Server 1.3.14
Linux Redhat 6.2


Regard's


Re: [PHP-DB] Close Postgresql Database Connection Problem !

2001-08-15 Thread Grant Johnson

Perrin wrote:
 == $connection  = pg_connect($constr user='$USER' password='$PW');
 
 Actually It should be closed the connection after access finished, like that 
pg_close();
 
 == pg_close($connection);
 
 But if the user force to close the web page that means have not close the 
connection. I want to ask the connection will be closed by Apache Server automatic ? 
or when user closed the web page the connection will be closed at the same time ? If 
the connection have not been closed automatic. So the Apache Server will keep the 
connect port forever ?
 Actually the connection port handle by Apache Server or PHP ?
 
If you use pg_connect, it will close when the script is finished, like
when the page is to the browser.  If you use pg_pconnect, it will stay
open for other pages to use.  I am not sure how pg_close affects a
pg_pconnect.  As most of the overhead with postgres is in opening the
connection, I use pg_pconnect, and never close it.  This improves
performance, but if I want to shutdown, I have to shutdown apache before
I shut down postgres just in case there was some recent activity, and it
hasn't timed out yet.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]