[MacOS][M1][Non-Docker][MAMP] Error: SQLSTATE[08006] [7] SCRAM authentication requires libpq version 10 or above [duplicate]

Configuration:

  1. MacOS Sonoma 14.2.1 (M1), NO DOCKER.

  2. PostgreSQL was installed from https://get.enterprisedb.com/postgresql/postgresql-16.2-1-osx.dmg , and

    psql --version psql (PostgreSQL) 14.11 (Homebrew)

  3. libpq was installed by:

    brew install libpq

  4. Also, libpg in MAMP PRO (PHP 8.3) (by phpinfo();)- version 9.4.24

On any login attemp via code (PGGSSENCMODE also added to php.ini):

putenv('PGGSSENCMODE=disable');

try {
    $pdo = new PDO("pgsql:host=$servername;dbname=$dbname;user=$username;password=$password");
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    echo "Success connection";

} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}

there is error SQLSTATE[08006] [7] SCRAM authentication requires libpq version 10 or above.

Also tryed:
in /opt/homebrew/var/postgresql@14/postgresql.conf set password_encryption = md5
in /opt/homebrew/var/postgresql@14/pg_hba.conf set METHOD = trust , also md5

Method dont changed from configuration file, so changed in session:

sudo psql postgres postgres 
SET password-encryption = ‘md5’;
ALTER USER "postgres" with password 'password';

but then login from console:

sudo psql postgres postgres 
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL:  password authentication failed for user "postgres"

login from php (the error persisted):

SQLSTATE[08006] [7] SCRAM authentication requires libpq version 10 or above

How to get (where to download) libpq.so 10.x for M1 (for replace in /Applications/MAMP/bin/php/php8.3.0/lib/php/extensions/no-debug-non-zts-20230831/)?

Its hardcode in module used non-md5 (scram-sha-256) method of authentification?