Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<pg_cancel_querypg_client_encoding>
^PostgreSQL FunctionsLast updated: Mon, 26 Oct 2026

pg_change_password

(PHP 8 >= 8.4.0)

pg_change_password — Change a PostgreSQL user's password

Description

function pg_change_password(PgSql\Connection $connection, string $user, #[\SensitiveParameter] string $password): bool

pg_change_password() changes the password of a PostgreSQL user. This function uses the PQchangePassword libpq function which handles password encryption automatically based on the server's settings.

Parameters

connection

An PgSql\Connection instance.

user

The name of the PostgreSQL user whose password to change.

password

The new password.

Return Values

Returns true on success or false on failure.

See Also


<pg_cancel_querypg_client_encoding>
^PostgreSQL FunctionsLast updated: Mon, 26 Oct 2026