Re: Close Postgresql Database Connection Problem !

From: Date: Thu, 16 Aug 2001 05:15:41 +0000
Subject: Re: Close Postgresql Database Connection Problem !
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11425@lists.php.net to get a copy of this message
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.

« previous php.db (#11425) next »