Re: php password authentication failed for user ...

Поиск
Список
Период
Сортировка
От basti
Тема Re: php password authentication failed for user ...
Дата
Msg-id 53C537F9.8030701@unix-solution.de
обсуждение исходный текст
Ответ на Re: php password authentication failed for user ...  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: php password authentication failed for user ...  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: php password authentication failed for user ...  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Hello Adrian,

Yes I use the correct cluster.

password authentication failed for user "testuser" ...
is a line from the postgres log

Yes I know what "trust" mean.

psql in version 9.3 can connect without error,
psql in version 9.1 connect to server 9.3 get the same error as above.

I have done the setup.
And I don't use ADO for this test.

I have also test

Postgres 9.1 and Postgres 9.4 both work with auth-method md5, except
postgres 9.3 discuss there.

It takes a round 5 hours to find this "error".
If anybody has the same problem be warned.

Regards,
basti


Am 15.07.2014 16:00, schrieb Adrian Klaver:
> On 07/15/2014 05:52 AM, basti wrote:
>> The last days I have done some tests and it seems that postgres 9.3 and
>> php 5.4.4 can't work together.
>
> I find that hard to believe.
>
>>
>> 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
>
> Again, no password is required and no authentication is done. The issue
> would if this did not work.
>
>>
>> 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"
>
> Is the line you think you are working with actually at line 89?
>
> Do you have more than one instance of Postgres running?
>
> In other words are you sure you are connecting to the correct cluster?
>
> Per Scotts suggestion, what does the Postgres log say when attempt the
> connection?
>
> To confirm, when you connect with psql with the md5 line enabled you can
> connect?
>
> The reason I ask is that psql and PHP both use the libpq library to
> connect.
>
> My money says you have an issue with the password/user/Postgres cluster
> combination.
>
>>
>> I have the problem on several servers, installed
>
> Where they set up by you or where they pre-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)
>
> I notice you have adodb installed.
> Are you using it when you try to connect above?
>
>>
>> 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?
>
> You can do that below, though at this point I do not think there is
> enough information to reach a conclusion.
>
> http://www.postgresql.org/support/submitbug/
>
>>
>> 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 по дате отправления:

Предыдущее
От: Steven Winfield
Дата:
Сообщение: Last reclustering time
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: php password authentication failed for user ...