Re: php password authentication failed for user ... - Mailing list pgsql-general

From basti
Subject Re: php password authentication failed for user ...
Date
Msg-id 53C523FC.9070605@unix-solution.de
Whole thread Raw
In response to Re: php password authentication failed for user ...  (Scott Marlowe <scott.marlowe@gmail.com>)
Responses Re: php password authentication failed for user ...  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: php password authentication failed for user ...  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-general
The last days I have done some tests and it seems that postgres 9.3 and
php 5.4.4 can't work together.

Can someone please confirm:

<?php
$host = "localhost";
$port = "5432";
$user = "testuser";
$pass = "mypasswd";
$db = "testdb";

echo "postgres test</br>";
$con = pg_connect("host=$host port=$port dbname=$db user=$user
password=$pass")
    or die ("Could not connect to server\n");
print_r($con);
?>

work well with
host    all    all    localhost    trust

in pg_hba.conf

When I use
host    all    all    localhost    md5

then I get the following error:

password authentication failed for user "testuser"
Connection matched pg_hba.conf line 89: "host    all             all
         localhost           md5"

I have the problem on several servers, installed

postgres: postgresql-9.3 (9.3.4-1.pgdg70+1),
postgresql-client-9.3(9.3.4-1.pgdg70+1),
postgresql-client-common(154.pgdg70+1), postgresql-common(154.pgdg70+1),
postgresql-contrib-9.3(9.3.4-1.pgdg70+1)
php: php5(5.4.4-14+deb7u12), libphp-adodb(5.15-1),
php5-pgsql(5.4.4-14+deb7u12)

When I try Postgres 9.1 and php 5.4.4 with md5 auth-method, it also
works very well.
Perhaps someone can do a bug report?

Thanks for any help!
Best regards,

basti


Am 10.07.2014 05:21, schrieb Scott Marlowe:
> On Wed, Jul 9, 2014 at 6:37 AM, basti <basti@unix-solution.de> wrote:
>> I don't know whats wrong there
>> host    mydns      mydns        localhost                       trust
>> works well and
>>
>> #host    all         all         0.0.0.0           0.0.0.0           md5
>> did not work.
>>
>> I use Postgres 9.3.4-1.pgdg70+1.
>>
>
> PHP should be telling you what you're doing wrong. Look in your logs
> etc. For example this code:
>
> <?php
> $conn = pg_connect("dbname=smarlowe host=localhost");
> ?>
>
> on my box gives me this warning:
>
> PHP Warning:  pg_connect(): Unable to connect to PostgreSQL server:
> fe_sendauth: no password supplied in /tmp/test.php on line 2
>
>


pgsql-general by date:

Previous
From: John McKown
Date:
Subject: Design ? table vs. view?
Next
From: Néstor Boscán
Date:
Subject: Re: Is there a way to get an update date for objects in pg_class