pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
conection problem after upgrade to php5 and postgres 8.0.3
3+ messages / 3 participants
[nested] [flat]

* conection problem after upgrade to php5 and postgres 8.0.3
@ 2006-01-11 18:01  John Coulthard <bahhab@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: John Coulthard @ 2006-01-11 18:01 UTC (permalink / raw)
  To: pgsql-php

Hi,

I've had to rebuild our web server and now my php scripts will not connect 
to postgres can anyone tell me why?

Thanks for any help, details below.
Annie

I was using Redhat9, postgres 7.3.4, php 4.2.2 and apache2
now using  Fedora core 4, postgres 8.0.3, php 5.0.4 and apache2

I know php is configured for psql 
http://zeldia.cap.ed.ac.uk/Lumbribase/php_info.php

In postgrsql.conf I tried changing listen_addresses = 'localhost' to 
listen_addresses = '*' but that didn't work.

I think the pg_hba.conf is OK..
# "local" is for Unix domain socket connections only
local   all         all                                 ident sameuser
# IPv4 local connections:
host    all         all         ***.*.*.*/**          ident sameuser
# IPv6 local connections:
host    all         all         ::*/***               ident sameuser

The error in /var/log/http/error_log is...
[client ***.***.***.***] PHP Warning:  pg_connect() [<a 
href='function.pg-connect'>function.pg-connect</a>]: Unable to connect to 
PostgreSQL server: FATAL:  Ident authentication failed for user 
&quot;webuser&quot; in /var/www/html/Lumbribase/pg_name.php on line 17, 
referer: http://zeldia.cap.ed.ac.uk/Lumbribase/search_id.php

and a typical php connection script is...
$PG_HOST="localhost";
$PG_PORT=5432;
$PG_DATABASE="lumbribase";
$PG_USER="webuser";
$PG_PASS="";
$PI=pi();

$dbconn=pg_connect( "dbname=$PG_DATABASE host=$PG_HOST port=$PG_PORT 
user=$PG_USER password=$PG_PASS" );
if ( ! $dbconn ) {
    echo "Error connecting to the database !<br> " ;
    printf("%s", pg_errormessage( $dbconn ) );
    exit();
}

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: conection problem after upgrade to php5 and postgres 8.0.3
@ 2006-01-11 18:20  Juan Miguel Paredes <juan.paredes@gmail.com>
  parent: John Coulthard <bahhab@hotmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Juan Miguel Paredes @ 2006-01-11 18:20 UTC (permalink / raw)
  To: John Coulthard <bahhab@hotmail.com>; +Cc: pgsql-php

Hi, John!

> I think the pg_hba.conf is OK..
> # "local" is for Unix domain socket connections only
> local   all         all                                 ident sameuser
> # IPv4 local connections:
> host    all         all         ***.*.*.*/**          ident sameuser
> # IPv6 local connections:
> host    all         all         ::*/***               ident sameuser

Note that the above configuration will use 'ident sameuser'
authentication for connections via tcp/ip (like the one you're trying
from your webserver).  So, your connection will need an OS account
(and no password supplied). That's what your error_log is telling you,
and I'm guessing that the account you're supplying for the connection
is not an OS account, but a Postgres account.  If you want to use
Postgres account authentication (e.g. users created via CREATE USER in
Postgres DB), perhaps you should try md5 authentication in your
pg_hba.conf.

More details in
http://www.postgresql.org/docs/8.0/interactive/client-authentication.html

Regards.
>
> The error in /var/log/http/error_log is...
> [client ***.***.***.***] PHP Warning:  pg_connect() [<a
> href='function.pg-connect'>function.pg-connect</a>]: Unable to connect to
> PostgreSQL server: FATAL:  Ident authentication failed for user
> "webuser" in /var/www/html/Lumbribase/pg_name.php on line 17,
> referer: http://zeldia.cap.ed.ac.uk/Lumbribase/search_id.php
>
> and a typical php connection script is...
> $PG_HOST="localhost";
> $PG_PORT=5432;
> $PG_DATABASE="lumbribase";
> $PG_USER="webuser";
> $PG_PASS="";
> $PI=pi();
>
> $dbconn=pg_connect( "dbname=$PG_DATABASE host=$PG_HOST port=$PG_PORT
> user=$PG_USER password=$PG_PASS" );
> if ( ! $dbconn ) {
>     echo "Error connecting to the database !<br> " ;
>     printf("%s", pg_errormessage( $dbconn ) );
>     exit();
> }
>



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SPAM] - conection problem after upgrade to php5 and postgres 8.0.3 - Bayesian Filter detected spam
@ 2006-01-11 18:21  Jason Minion <jason.minion@sigler.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Jason Minion @ 2006-01-11 18:21 UTC (permalink / raw)
  To: John Coulthard <bahhab@hotmail.com>; pgsql-php

Did you create the webuser local account on the server after it was
rebuilt? Check out:

http://www.postgresql.org/docs/8.0/interactive/auth-methods.html#AUTH-ID
ENT

Assuming you are trying to use sameuser. Also, it might be worth
checking that your ident service is running and is reachable. If you
have SELinux running it will complicate matters further. 


Jason Minion
IT Developer
Sigler Printing & Publishing
413 Northwestern Ave
Ames, IA 50010
515-232-6997
jason.minion@sigler.com

-----Original Message-----
From: pgsql-php-owner@postgresql.org
[mailto:pgsql-php-owner@postgresql.org] On Behalf Of John Coulthard
Sent: Wednesday, January 11, 2006 12:02 PM
To: pgsql-php@postgresql.org
Subject: [SPAM] - [PHP] conection problem after upgrade to php5 and
postgres 8.0.3 - Bayesian Filter detected spam

Hi,

I've had to rebuild our web server and now my php scripts will not
connect to postgres can anyone tell me why?

Thanks for any help, details below.
Annie

I was using Redhat9, postgres 7.3.4, php 4.2.2 and apache2 now using
Fedora core 4, postgres 8.0.3, php 5.0.4 and apache2

I know php is configured for psql
http://zeldia.cap.ed.ac.uk/Lumbribase/php_info.php

In postgrsql.conf I tried changing listen_addresses = 'localhost' to
listen_addresses = '*' but that didn't work.

I think the pg_hba.conf is OK..
# "local" is for Unix domain socket connections only
local   all         all                                 ident sameuser
# IPv4 local connections:
host    all         all         ***.*.*.*/**          ident sameuser
# IPv6 local connections:
host    all         all         ::*/***               ident sameuser

The error in /var/log/http/error_log is...
[client ***.***.***.***] PHP Warning:  pg_connect() [<a
href='function.pg-connect'>function.pg-connect</a>]: Unable to connect
to PostgreSQL server: FATAL:  Ident authentication failed for user
&quot;webuser&quot; in /var/www/html/Lumbribase/pg_name.php on line 17,
referer: http://zeldia.cap.ed.ac.uk/Lumbribase/search_id.php

and a typical php connection script is...
$PG_HOST="localhost";
$PG_PORT=5432;
$PG_DATABASE="lumbribase";
$PG_USER="webuser";
$PG_PASS="";
$PI=pi();

$dbconn=pg_connect( "dbname=$PG_DATABASE host=$PG_HOST port=$PG_PORT
user=$PG_USER password=$PG_PASS" ); if ( ! $dbconn ) {
    echo "Error connecting to the database !<br> " ;
    printf("%s", pg_errormessage( $dbconn ) );
    exit();
}

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!

http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-01-11 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-01-11 18:01 conection problem after upgrade to php5 and postgres 8.0.3 John Coulthard <bahhab@hotmail.com>
2006-01-11 18:20 ` Juan Miguel Paredes <juan.paredes@gmail.com>
2006-01-11 18:21 Re: [SPAM] - conection problem after upgrade to php5 and postgres 8.0.3 - Bayesian Filter detected spam Jason Minion <jason.minion@sigler.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox