Re: [GENERAL] php password authentication failed for user ...

2014-07-16 Thread basti
Yes all clusters, run on the same machine.
All packages are from pgdg.
libpq5 is version  9.3.4-1.pgdg70+1
the problem is still the same,
The relevant database is only for testing and development,
I will downgrade to 9.1.

Thanks for helping.

Regards,
basti

Am 15.07.2014 16:46, schrieb Adrian Klaver:
 On 07/15/2014 07:17 AM, basti wrote:
 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.
 
 To follow up on my previous post.
 
 Are all these clusters running on the same machine?
 
 Where they all installed from the same source, pgdg,  or are they from
 different sources?
 
 I have to go, so I will get back to this later, though I suspect wiser
 minds then mine will get you an answer in the interim.
 

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

 Regards,
 basti

 
 


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-16 Thread Marc Mamin


 -Original Message-
 From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-
 ow...@postgresql.org] On Behalf Of basti
 Sent: Mittwoch, 16. Juli 2014 10:14
 To: pgsql-general@postgresql.org
 Subject: Re: [GENERAL] php password authentication failed for user ...
 
 Yes all clusters, run on the same machine.
 All packages are from pgdg.
 libpq5 is version  9.3.4-1.pgdg70+1
 the problem is still the same,
 The relevant database is only for testing and development, I will downgrade to
 9.1.



Hello,
Did you already try to connect using the IP instead of localhost ?

regards,

Marc Mamin


 
 Thanks for helping.
 
 Regards,
 basti
 
 Am 15.07.2014 16:46, schrieb Adrian Klaver:
  On 07/15/2014 07:17 AM, basti wrote:
  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.
 
  To follow up on my previous post.
 
  Are all these clusters running on the same machine?
 
  Where they all installed from the same source, pgdg,  or are they from
  different sources?
 
  I have to go, so I will get back to this later, though I suspect wiser
  minds then mine will get you an answer in the interim.
 
 
  It takes a round 5 hours to find this error.
  If anybody has the same problem be warned.
 
  Regards,
  basti
 
 
 
 
 
 --
 Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make
 changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-general

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-16 Thread Adrian Klaver

On 07/16/2014 01:13 AM, basti wrote:

Yes all clusters, run on the same machine.
All packages are from pgdg.
libpq5 is version  9.3.4-1.pgdg70+1


That is not what a previous post indicated:

dpkg -l | grep libpq
ii  libpq5 9.1.13-0wheezy1
amd64PostgreSQL C client library



the problem is still the same,
The relevant database is only for testing and development,
I will downgrade to 9.1.


I have a feeling that is not going to solve what I think is the 
underlying issue, you have a mixed source install of packages.




Thanks for helping.

Regards,
basti



--
Adrian Klaver
adrian.kla...@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-16 Thread basti
psql in version 9.1 connect to server 9.3 get the same error as above.
=
dpkg -l | grep libpq
ii  libpq5 9.1.13-0wheezy1
amd64PostgreSQL C client library

the other I cant say, now thats
ii  libpq5:amd64 9.4~beta1-2.pgdg70+1
amd64PostgreSQL C client library


Am 15.07.2014 16:33, schrieb Adrian Klaver:
 On 07/15/2014 07:17 AM, basti wrote:
 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.
 
 That would seem to indicate that you have a version issue with libpq.
 
 What does dkpg  show for installed versions of libpq?
 

 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.
 
 What exactly does that mean?
 
 If anybody has the same problem be warned.

 Regards,
 basti

 
 


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-15 Thread basti
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
hostall all localhost   trust

in pg_hba.conf

When I use
hostall all localhost   md5

then I get the following error:

password authentication failed for user testuser
Connection matched pg_hba.conf line 89: hostall 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 ba...@unix-solution.de wrote:
 I don't know whats wrong there
 hostmydns  mydnslocalhost   trust
 works well and

 #hostall 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
 
 


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-15 Thread 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
hostall 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
hostall all localhost   md5

then I get the following error:

password authentication failed for user testuser
Connection matched pg_hba.conf line 89: hostall 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 ba...@unix-solution.de wrote:

I don't know whats wrong there
hostmydns  mydnslocalhost   trust
works well and

#hostall 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








--
Adrian Klaver
adrian.kla...@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-15 Thread Adrian Klaver

On 07/15/2014 07:17 AM, basti wrote:

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.


That would seem to indicate that you have a version issue with libpq.

What does dkpg  show for installed versions of libpq?



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.


What exactly does that mean?


If anybody has the same problem be warned.

Regards,
basti




--
Adrian Klaver
adrian.kla...@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-15 Thread basti
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
 hostallalllocalhosttrust
 
 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
 hostallalllocalhostmd5

 then I get the following error:

 password authentication failed for user testuser
 Connection matched pg_hba.conf line 89: hostall 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 ba...@unix-solution.de wrote:
 I don't know whats wrong there
 hostmydns  mydnslocalhost   trust
 works well and

 #hostall 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




 
 


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-15 Thread basti
psql in version 9.1 connect to server 9.3 get the same error as above.
=
dpkg -l | grep libpq
ii  libpq5 9.1.13-0wheezy1
amd64PostgreSQL C client library

the other I cant say, now thats
ii  libpq5:amd64 9.4~beta1-2.pgdg70+1
amd64PostgreSQL C client library


Am 15.07.2014 16:33, schrieb Adrian Klaver:
 On 07/15/2014 07:17 AM, basti wrote:
 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.
 
 That would seem to indicate that you have a version issue with libpq.
 
 What does dkpg  show for installed versions of libpq?
 

 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.
 
 What exactly does that mean?
 
 If anybody has the same problem be warned.

 Regards,
 basti

 
 




-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-15 Thread Adrian Klaver

On 07/15/2014 07:17 AM, basti wrote:

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.


To follow up on my previous post.

Are all these clusters running on the same machine?

Where they all installed from the same source, pgdg,  or are they from 
different sources?


I have to go, so I will get back to this later, though I suspect wiser 
minds then mine will get you an answer in the interim.




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

Regards,
basti




--
Adrian Klaver
adrian.kla...@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-15 Thread Daniel Verite
basti wrote:

 hostall all localhost   md5
 
 then I get the following error:
 
 password authentication failed for user testuser

Aside from submitting a wrong password, a less obvious cause for this error
message is when the password is expired.

Not so long ago, there was an insidious bug in pgAdmin that caused the
password validity to be possibly set in the past when editing a user account.
This results in that password authentication failed error when trying to
connect with the correct password.

Here's the relevant changelog entry, from
http://www.pgadmin.org/development/changelog.php

2012-11-28 AV  1.16.1  Date picker controls returns a full timestamp by 
   default, which can cause inadvertent date changes
   on jobs and role validty dates. Ignore the time part.

If you happen to use pgadmin, check its version and your problematic
account's validity (valuntil field in the pg_user view). Reset it if needed
with:

ALTER USER username VALID UNTIL 'infinity';


Best regards,
-- 
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-15 Thread Adrian Klaver

On 07/15/2014 07:45 AM, basti wrote:

psql in version 9.1 connect to server 9.3 get the same error as above.
=
dpkg -l | grep libpq
ii  libpq5 9.1.13-0wheezy1
amd64PostgreSQL C client library

the other I cant say, now thats
ii  libpq5:amd64 9.4~beta1-2.pgdg70+1
amd64PostgreSQL C client library




Well it looks like different sources for the packages.

I am not sure I am following your listings above.

Are they on the same machine?

What does ldd show for the various psql versions and the php extension 
pgsql.so?


My suspicion is that the PHP extension and/or the Postgres 9.1 psql are 
linked to the wrong file.



--
Adrian Klaver
adrian.kla...@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-10 Thread Francisco Olarte
Hi:

On Wed, Jul 9, 2014 at 2:37 PM, basti ba...@unix-solution.de wrote:
 I don't know whats wrong there
 hostmydns  mydnslocalhost   trust
 works well and
 #hostall all 0.0.0.0   0.0.0.0   md5
 did not work.

 I use Postgres 9.3.4-1.pgdg70+1.

Well, first line should be no password, user mydns, db mydns, host
localhost ( which USUALLY is 127.0.0.1 ), no credential checks, so if
you are not changing anything between ( or not showing the complete
file ) it means you have user, db, method ( tcp ) and origin host
right.

Second one is any user, any db, any IP, but checking password.

Giving that the only think the second line checks which the first one
does not, I'll vote for bad password in the script. I suppose php uses
libpq, like psql, so it should work. Anyway, check your paths and
constants,  isolate changes, test. This kind of problems are imposible
to diagnose without much more info than what you are giving, and
normally due to mystyped constants.

Francisco Olarte.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-10 Thread Ken Tanzer
On Wed, Jul 9, 2014 at 5:37 AM, basti ba...@unix-solution.de wrote:


 #hostall all 0.0.0.0   0.0.0.0   md5
 did not work.


If it really starts with a # like you show it above, it's just a comment
and pretty much guaranteed not to do anything.

Cheers,
Ken


-- 
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ http://agency-software.org/*
*https://agency-software.org/demo/client
https://agency-software.org/demo/client*
ken.tan...@agency-software.org
(253) 245-3801

Subscribe to the mailing list
agency-general-requ...@lists.sourceforge.net?body=subscribe to
learn more about AGENCY or
follow the discussion.


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread Bill Moran
On Wed, 09 Jul 2014 13:04:19 +0200 basti mailingl...@unix-solution.de wrote:

 Hello my pg_hab.conf has this entry:
 
 hostall all 127.0.0.1/32md5
 
 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?

-- 
Bill Moran wmo...@potentialtech.com


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread Francisco Olarte
Hi:

On Wed, Jul 9, 2014 at 1:04 PM, basti mailingl...@unix-solution.de wrote:
 Hello my pg_hab.conf has this entry:
 hostall all 127.0.0.1/32md5

 global $dbhost, $dbuser, $dbpass, $dbname, $use_pgsql, $dbconn;
...
 $connect = host=$dbhost user=$dbuser password=$dbpass
 dbname=$dbname;
...
 When I try to connect via
 psql -U user  -h localhost -W database

Which is the value of $dbhost ? is it localhost, to be coherent with
your psql line? ( or the output of the echo you put in the sample
script? )

If $dbhost is not localhost a name which resolves to 127.0.0.1 or a
literal 127.0.0.1 you are not getting in ( if the machine is 3.4.5.6
and you connect to machine.name.com which resolves to 3.4.5.6 your
usually get this kind of problems.

Francisco Olarte.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread basti
Yes, there is the same problem.
postgres logs also:

Connection matched pg_hba.conf line 93
„hostall all 127.0.0.1/32md5“

Am 09.07.2014 13:14, schrieb Bill Moran:
 On Wed, 09 Jul 2014 13:04:19 +0200 basti mailingl...@unix-solution.de wrote:
 
 Hello my pg_hab.conf has this entry:

 hostall all 127.0.0.1/32md5

 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?
 


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread basti
Here is the output of the echo.

host=127.0.0.1 user=mydns password=mypass sslmode=allow dbname=mydns

I have also try host=localhost and sslmode=require


Am 09.07.2014 13:47, schrieb Francisco Olarte:
 Hi:
 
 On Wed, Jul 9, 2014 at 1:04 PM, basti mailingl...@unix-solution.de wrote:
 Hello my pg_hab.conf has this entry:
 hostall all 127.0.0.1/32md5
 
 global $dbhost, $dbuser, $dbpass, $dbname, $use_pgsql, $dbconn;
 ...
 $connect = host=$dbhost user=$dbuser password=$dbpass
 dbname=$dbname;
 ...
 When I try to connect via
 psql -U user  -h localhost -W database
 
 Which is the value of $dbhost ? is it localhost, to be coherent with
 your psql line? ( or the output of the echo you put in the sample
 script? )
 
 If $dbhost is not localhost a name which resolves to 127.0.0.1 or a
 literal 127.0.0.1 you are not getting in ( if the machine is 3.4.5.6
 and you connect to machine.name.com which resolves to 3.4.5.6 your
 usually get this kind of problems.
 
 Francisco Olarte.
 


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread Adrian Klaver

On 07/09/2014 04:04 AM, basti wrote:

Hello my pg_hab.conf has this entry:

hostall all 127.0.0.1/32md5


Is that the only entry?

If not remember first matching entry wins, so is there another line 
above this?




When I try to use PHP to connect to the Database I get

postgres password authentication failed for user ...


Is the password correct?



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?


From:

http://www.postgresql.org/docs/9.3/interactive/auth-pg-hba-conf.html

host

This record matches connection attempts made using TCP/IP. host 
records match either SSL or non-SSL connection attempts.





Regards,
basti





--
Adrian Klaver
adrian.kla...@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread basti
There are other entrys in pg_hab.conf and yes the passwd is correct.
(psql -p ... -h ... from command line runs well).


I don't know whats wrong there
hostmydns  mydnslocalhost   trust
works well and

#hostall all 0.0.0.0   0.0.0.0   md5
did not work.

I use Postgres 9.3.4-1.pgdg70+1. (debian)


Am 09.07.2014 15:06, schrieb Adrian Klaver:
 On 07/09/2014 04:04 AM, basti wrote:
 Hello my pg_hab.conf has this entry:

 hostall all 127.0.0.1/32md5
 
 Is that the only entry?
 
 If not remember first matching entry wins, so is there another line
 above this?
 

 When I try to use PHP to connect to the Database I get

 postgres password authentication failed for user ...
 
 Is the password correct?
 

 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?
 
 From:
 
 http://www.postgresql.org/docs/9.3/interactive/auth-pg-hba-conf.html
 
 host
 
 This record matches connection attempts made using TCP/IP. host
 records match either SSL or non-SSL connection attempts.
 
 

 Regards,
 basti


 
 


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread rob stone



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
 „hostall all 127.0.0.1/32md5“
 
 Am 09.07.2014 13:14, schrieb Bill Moran:
  On Wed, 09 Jul 2014 13:04:19 +0200 basti mailingl...@unix-solution.de 
  wrote:
  
  Hello my pg_hab.conf has this entry:
 
  hostall all 127.0.0.1/32md5
 
  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



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread Adrian Klaver

On 07/09/2014 06:10 AM, basti wrote:

There are other entrys in pg_hab.conf and yes the passwd is correct.


So what are the other entries and where are they relative to the line 
that you think is causing the problem?



(psql -p ... -h ... from command line runs well).


In your first post you showed this:

psql -U user  -h localhost -W database

The password supplied here could come from a .pgpass file or env 
variable so it does not necessarily mean that the same password is being 
used that is used in the script.





I don't know whats wrong there
hostmydns  mydnslocalhost   trust
works well and


Well no password is being asked for in the above.



#hostall all 0.0.0.0   0.0.0.0   md5
did not work.


In you original post you have as the problem line:

hostall all 127.0.0.1/32md5

Have you tried both?

Just to be certain, have you done  pg_ctl reload after each change?




I use Postgres 9.3.4-1.pgdg70+1. (debian)





--
Adrian Klaver
adrian.kla...@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread Adrian Klaver

On 07/09/2014 06:19 AM, rob stone wrote:








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.


AFAIK PHP, in the connect function, takes care of encrypting the 
password for you.




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

HTH
Robert






--
Adrian Klaver
adrian.kla...@aklaver.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread basti
Is there a simple md5 hash?
I also try to hash my passwd via md5.
There is sill the same error.

Am 09.07.2014 15:19, schrieb rob stone:
 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.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread Alban Hertroys
On 9 July 2014 15:10, basti mailingl...@unix-solution.de wrote:
 There are other entrys in pg_hab.conf and yes the passwd is correct.
 (psql -p ... -h ... from command line runs well).

I do hope you're looking in a file named pg_hba.conf and not
pg_hab.conf? The latter is unknown to PG, you should throw that away
if it's there as it will only serve to confuse people.

-- 
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread Scott Marlowe
On Wed, Jul 9, 2014 at 5:04 AM, basti mailingl...@unix-solution.de wrote:
 Hello my pg_hab.conf has this entry:

 hostall all 127.0.0.1/32md5

 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.);
 }


This is not proper error handling. Use the pg_* functions that report
the actual error, not some string you made on your own.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread basti
I don't know whats wrong there
hostmydns  mydnslocalhost   trust
works well and

#hostall all 0.0.0.0   0.0.0.0   md5
did not work.

I use Postgres 9.3.4-1.pgdg70+1.


Am 09.07.2014 14:04, schrieb basti:
 Here is the output of the echo.
 
 host=127.0.0.1 user=mydns password=mypass sslmode=allow dbname=mydns
 
 I have also try host=localhost and sslmode=require
 
 
 Am 09.07.2014 13:47, schrieb Francisco Olarte:
 Hi:

 On Wed, Jul 9, 2014 at 1:04 PM, basti mailingl...@unix-solution.de wrote:
 Hello my pg_hab.conf has this entry:
 hostall all 127.0.0.1/32md5
 
 global $dbhost, $dbuser, $dbpass, $dbname, $use_pgsql, $dbconn;
 ...
 $connect = host=$dbhost user=$dbuser password=$dbpass
 dbname=$dbname;
 ...
 When I try to connect via
 psql -U user  -h localhost -W database

 Which is the value of $dbhost ? is it localhost, to be coherent with
 your psql line? ( or the output of the echo you put in the sample
 script? )

 If $dbhost is not localhost a name which resolves to 127.0.0.1 or a
 literal 127.0.0.1 you are not getting in ( if the machine is 3.4.5.6
 and you connect to machine.name.com which resolves to 3.4.5.6 your
 usually get this kind of problems.

 Francisco Olarte.

 
 


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] php password authentication failed for user ...

2014-07-09 Thread Scott Marlowe
On Wed, Jul 9, 2014 at 6:37 AM, basti ba...@unix-solution.de wrote:
 I don't know whats wrong there
 hostmydns  mydnslocalhost   trust
 works well and

 #hostall 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


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general