Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open a basic connection to postgres #53

Open
yaldamahmoodi opened this issue May 11, 2023 · 2 comments
Open

Can't open a basic connection to postgres #53

yaldamahmoodi opened this issue May 11, 2023 · 2 comments

Comments

@yaldamahmoodi
Copy link

The basic example in README.md isn't working in my case. I got the below error message when I wanted to connect to the database:

Uncaught Exception: Bad connection: Unhandled authentication message: 10 in /home/yalda/PhpstormProjects/testing-voryxPgAsyncLib/vendor/voryx/pgasync/src/PgAsync/Connection.php:514

Also, I double-checked that I set up the user & database correctly in psql and recheck all of it with a classic example of pure PHP code which is worked very well but when I use your library it is not even connect.

OS: Ubuntu 22.04
Postgres Version: 14.7

This is the basic example which throws the exception:

require "vendor/autoload.php";

$client = new PgAsync\Client([
    "host" => "127.0.0.1",
    "port" => "5432",
    "user" => "yalda",
    "database" => "yalda",
    "password" => "****"
]);

$client->query('select * from accounts')->subscribe(
    function ($row) {
        var_dump($row);
    },
    function ($e) {
        echo "Failed.\n";
    },
    function () {
        echo "Complete.\n";
    }
);
@hasanparasteh
Copy link

I think currently PgAsync only supports md5 and plaintext (password) authentication methods and this is the root cause of your problem. For now you can try and change authentication method to md5 if you want!

SET password_encryption = 'md5';
ALTER USER <USERNAME> WITH PASSWORD <PASSWORD>;

@hasanparasteh
Copy link

@mbonneau What's your idea about supporting scram-sha-256 authentication method in PgAsync?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants