conection problem after upgrade to php5 and postgres 8.0.3

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
"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();
}

____________________________________________________________ _____
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
John Coulthard [ Mi, 11 Januar 2006 19:01 ] [ ID #1137019 ]

Re: conection problem after upgrade to php5 and postgres 8.0.3

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-authen tication.html

Regards.
>
> The error in /var/log/http/error_log is...
> [client ***.***.***.***] PHP Warning: pg_connect() [<a
> href=3D'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=3D"localhost";
> $PG_PORT=3D5432;
> $PG_DATABASE=3D"lumbribase";
> $PG_USER=3D"webuser";
> $PG_PASS=3D"";
> $PI=3Dpi();
>
> $dbconn=3Dpg_connect( "dbname=3D$PG_DATABASE host=3D$PG_HOST port=3D$PG_P=
ORT
> user=3D$PG_USER password=3D$PG_PASS" );
> if ( ! $dbconn ) {
> echo "Error connecting to the database !<br> " ;
> printf("%s", pg_errormessage( $dbconn ) );
> exit();
> }
>

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Juan Miguel Paredes [ Mi, 11 Januar 2006 19:20 ] [ ID #1137022 ]
Datenbanken » gmane.comp.db.postgresql.php » conection problem after upgrade to php5 and postgres 8.0.3

Vorheriges Thema: Re: [SPAM] - conection problem after upgrade to php5 and postgres 8.0.3 - Bayesian Filter detected s
Nächstes Thema: Sync local with remote databases