pg_pconnect

FunctionReturn type changed in PHP 8.1

Open a persistent PostgreSQL connection.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
Improved
PHP 8.2-8.3
PHP 8.4
PHP 8.5
PHP 8.6

pg_pconnect Function synopsis

pg_pconnect(string $connection_string, int $flags = 0): PgSql\Connection|false

Parameters

$connection_string

Typestring

The $connection_string can be empty to use all default parameters, or it can contain one or more parameter settings separated by whitespace. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value or a value containing spaces, surround it with single quotes, e.g., keyword = 'a value'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \\.

$flags

OptionalTypeintDefault value0

If PGSQL_CONNECT_FORCE_NEW is passed, then a new connection is created, even if the $connection_string is identical to an existing connection.

Return value

TypePgSql\Connection|false

Returns a PgSql\Connection instance on success, or false on failure.

Changes to the pg_pconnect Function

PHP 8.1

  • Return type added: PgSql\Connection|false
- pg_pconnect(string $connection_string, int $flags = 0)
+ pg_pconnect(string $connection_string, int $flags = 0): PgSql\Connection|false

PHP 8.0

  • Parameter count changed: 6 to 2
  • Optional parameter removed - #3: $port
  • Optional parameter removed - #4: $options
  • Optional parameter removed - #5: $tty
  • Optional parameter removed - #6: $database
-pg_pconnect(
-    $connection_string,
-    $host,
-    $port,
-    $options,
-    $tty,
-    $database
-  )
+pg_pconnect(string $connection_string, int $flags = 0)

pg_pconnect Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release Yes
PHP 8.5Supported (Latest) Yes
PHP 8.4Supported Yes
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes