Re: php password authentication failed for user ...

From: rob stone <floriparob(at)gmail(dot)com>
To: basti <mailinglist(at)unix-solution(dot)de>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: php password authentication failed for user ...
Date: 2014-07-09 13:19:48
Message-ID: 1404911988.2443.18.camel@roblaptop.virtua.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2014-07-09 at 14:01 +0200, basti wrote:
> Yes, there is the same problem.
> postgres logs also:
>
> "Connection matched pg_hba.conf line 93
> „host all all 127.0.0.1/32 md5“"
>
> Am 09.07.2014 13:14, schrieb Bill Moran:
> > On Wed, 09 Jul 2014 13:04:19 +0200 basti <mailinglist(at)unix-solution(dot)de> wrote:
> >
> >> Hello my pg_hab.conf has this entry:
> >>
> >> host all all 127.0.0.1/32 md5
> >>
> >> When I try to use PHP to connect to the Database I get
> >>
> >> "postgres password authentication failed for user ..."
> >>
> >> The PHP-code looks like
> >>
> >>
> >> global $dbhost, $dbuser, $dbpass, $dbname, $use_pgsql, $dbconn;
> >>
> >> if ($use_pgsql)
> >> {
> >> $connect = "host=$dbhost user=$dbuser password=$dbpass
> >> dbname=$dbname";
> >> echo $connect;
> >> if (!($dbconn = pg_connect($connect)))
> >> {
> >> open_page();
> >> ErrSQL("Unable to connect to database.");
> >> }
> >>
> >> When I try to connect via
> >> psql -U user -h localhost -W database
> >> I can connect without error.
> >>
> >> I also use SSL connections, is this the problem? or in other words is
> >> there a way to connect php via (postgres) ssl?
> >
> > Have you tried using sslmode or requiressl in the $connect string?
> >
>
>

You need to use "sslmode=require".

Are you encrypting the password? If not, alter the pg_hba.conf file to
"trust" instead of md5. If it's all running on localhost it's no big
deal.

Is the postgresql.conf file and your Apache config file in the
sites-available path compatible with SSL usage?

HTH
Robert

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-07-09 13:23:06 Re: php password authentication failed for user ...
Previous Message basti 2014-07-09 13:10:55 Re: php password authentication failed for user ...