User Contributed Notes: pg_pconnect
jakr@dial.pipex.com
17-Sep-1999 12:29
What is the 'options' string for ? Is it for specifying a userid/password ? If not, I think this is important functionality, since currently databases must provide access to user 'nobody' if that is how apache is set up (and it usually is). By being able to specify user/password, and configuring postgresql to accept these kinds of connections, security would be improved ? At the moment, it seems the only reasonable solution to using PHP/pgsql is to have PHP being or wrapped in a setuid.
epowell@yuck.net
31-Oct-1999 08:57
Reading the PostgreSQL programming documentation is helpful in figuring out what things like what goes into the 'options' string... the PHP interface appears to be heavily based on PostgreSQL's libpq programming interface.
bobesr@yahoo.com
18-Jan-2000 11:32
URGENT PLease:
What is the difference between pg_connect and pg_pconnect ?
If the script crash (or stop) befor pg_close the connection will
be still ? If yes how can I close it ? Do I need to close it ?
guenther.mair@web.by.com
28-Jan-2000 09:32
i figured out that persistant connections are far faster as general connections if you are doing multiple selects on your tables. this should happen for other sql queries too, of course. however up to now i'm not able to close persistant connections with pg_close. is this a bug? is there something not mentioned here, that i am missing? help would be heavily appreciated!
guenther.mair@web.by.com
31-Jan-2000 10:10
for further information have a look at http://www.php.net/manual/features.persistent-connections.php3
php@elysium.ltd.uk
22-Feb-2000 11:01
The easiest way to connect to a PostgreSQL DB as another user is to do something like the following:
<pre>
$db_options = "host=<hostname|ip address> user=<username> password=password";
</pre>
Then to do a persistent connection do:
<pre>
pg_pConnect($db_options);
</pre>
or for a non persistent connection do:
pg_Connect($db_options);
clecerf@univ-paris8.fr
23-Mar-2000 10:00
The "Options" parameter. It seems to worry some users...
Refering to the libpq doc of Postgres, it is used to set trace/debug options to be sent to backend.
Probably no use for a PHP3 programmer.
tumor@iris.kkt.bme.hu
30-Mar-2000 05:39
Well, pg_pconnect is ALMOST identical to pg_Connect. The difference is that when you make something nasty with the PSQL server (like reseting it) then pg_pConnect still tryes to use the previous connection. This creates some nice broken_pipe errors (and maybe some more). I do not know that resetting the http server would help it, I think it would. As pg_connect creates a new connection every time (that is why it is \"so slow\") this error does not occurs with it. Really this is not a bug, but perphaps you could do something with it, and it may help some people working with recently changing pg security settings... Good bug hunting...
dmitri@graphictype.com
10-May-2000 04:12
<pre>
How to reset persistent connections:
killall -USR1 httpd
</pre>