pg_pconnect() opens a connection to a PostgreSQL database. It returns a connection resource that is needed by other PostgreSQL functions.
It returns a connection resource on success, or FALSE if the connection could not be made. The arguments should be within a quoted string. The arguments available include host, port, tty, options, dbname, user, and password.
If a second call is made to pg_pconnect() with the same arguments, no new connection will be established, but instead, the connection resource of the already opened connection will be returned. You can have multiple connections to the same database if you use different connection patameters. (i.e. Use different username)
Multiple parameters syntax for pg_pconnect() $conn = pg_pconnect ("host", "port", "options", "tty", "dbname") has been deprecated.
To enable persistent connection, pgsql.allow_persistent php.ini directive must be set to "On". (Default is On) Max number of persistent connection can be defined by pgsql.max_persistent php.ini directive. (Default is -1 which is no limit) Total number of connection can be set by pgsql.max_links php.ini directive.
pg_close() will not close persistent links generated by pg_pconnect().
See also pg_connect().