Re: php password authentication failed for user ...

From: basti <mailinglist(at)unix-solution(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: php password authentication failed for user ...
Date: 2014-07-15 12:52:12
Message-ID: 53C523FC.9070605@unix-solution.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)unix-solution(dot)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
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Néstor Boscán 2014-07-15 13:07:29 Re: Is there a way to get an update date for objects in pg_class
Previous Message John McKown 2014-07-15 12:33:56 Design ? table vs. view?