Search Postgresql Archives

Re: php password authentication failed for user ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx> 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
> 
> 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux