From bahhab@hotmail.com Wed Jan 11 18:02:00 2006 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 49F9C9DC9A5 for ; Wed, 11 Jan 2006 14:02:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30184-06 for ; Wed, 11 Jan 2006 14:01:59 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 963799DC98E for ; Wed, 11 Jan 2006 14:01:57 -0400 (AST) Received: from hotmail.com (bay13-f14.bay13.hotmail.com [64.4.31.14]) by svr4.postgresql.org (Postfix) with ESMTP id F26265AF031 for ; Wed, 11 Jan 2006 18:01:57 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 11 Jan 2006 10:01:50 -0800 Message-ID: Received: from 129.215.170.72 by by13fd.bay13.hotmail.msn.com with HTTP; Wed, 11 Jan 2006 18:01:49 GMT X-Originating-IP: [129.215.170.72] X-Originating-Email: [bahhab@hotmail.com] X-Sender: bahhab@hotmail.com From: "John Coulthard" To: pgsql-php@postgresql.org Subject: conection problem after upgrade to php5 and postgres 8.0.3 Date: Wed, 11 Jan 2006 18:01:49 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 11 Jan 2006 18:01:50.0236 (UTC) FILETIME=[188EBDC0:01C616D9] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.919 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, MSGID_FROM_MTA_HEADER=0] X-Spam-Score: 1.919 X-Spam-Level: * X-Archive-Number: 200601/23 X-Sequence-Number: 3394 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() [function.pg-connect]: 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 !
" ; 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/ From juan.paredes@gmail.com Wed Jan 11 18:20:15 2006 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B95739DC874 for ; Wed, 11 Jan 2006 14:20:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34355-05 for ; Wed, 11 Jan 2006 14:20:11 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.195]) by postgresql.org (Postfix) with ESMTP id A9DD59DC802 for ; Wed, 11 Jan 2006 14:20:09 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s14so151231wxc for ; Wed, 11 Jan 2006 10:20:10 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LYFdpBgjUgruOnxy6Q4dTQpe+X628tUSfIZyOExVkEMW6798M+dTgGJmd1LL3VDuQPIVTmp5sdkHKnbTrt7nhMafhpGIPZzM+B6Fs7yXK+uz+hLa2dfCrwecBNhHHKv5VfVcSpovoSUelwEYMOBztdHivaZktEtqNiPLdPGZFLA= Received: by 10.70.82.7 with SMTP id f7mr1141582wxb; Wed, 11 Jan 2006 10:20:09 -0800 (PST) Received: by 10.70.48.13 with HTTP; Wed, 11 Jan 2006 10:20:09 -0800 (PST) Message-ID: <9e0a28690601111020k757ce970g16636a47e0f7dd9e@mail.gmail.com> Date: Wed, 11 Jan 2006 14:20:09 -0400 From: Juan Miguel Paredes To: John Coulthard Subject: Re: conection problem after upgrade to php5 and postgres 8.0.3 Cc: pgsql-php@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200601/26 X-Sequence-Number: 3397 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() [ href=3D'function.pg-connect'>function.pg-connect]: 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 !
" ; > printf("%s", pg_errormessage( $dbconn ) ); > exit(); > } > From jason.minion@sigler.com Wed Jan 11 18:21:54 2006 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 935649DCA1C for ; Wed, 11 Jan 2006 14:21:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 33566-09 for ; Wed, 11 Jan 2006 14:21:53 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 09BEF9DCA10 for ; Wed, 11 Jan 2006 14:21:52 -0400 (AST) Received: from exchange.siglercompanies.com (sig-gw.isunet.net [63.175.165.221]) by svr4.postgresql.org (Postfix) with ESMTP id 974CA5AF077 for ; Wed, 11 Jan 2006 18:21:52 +0000 (GMT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: [SPAM] - conection problem after upgrade to php5 and postgres 8.0.3 - Bayesian Filter detected spam Date: Wed, 11 Jan 2006 12:21:06 -0600 Message-ID: <0105A1BF505D304E9E5AF38B63E40E4ED7EAA0@EXCHANGE.siglercompanies.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SPAM] - [PHP] conection problem after upgrade to php5 and postgres 8.0.3 - Bayesian Filter detected spam Thread-Index: AcYW2REdxIVJiyk9RluxgbivHFbxmQAAcd9g From: "Jason Minion" To: "John Coulthard" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.657 required=5 tests=[AWL=0.657] X-Spam-Score: 0.657 X-Spam-Level: X-Archive-Number: 200601/28 X-Sequence-Number: 3399 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.=20 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 =3D 'localhost' to listen_addresses =3D '*' 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() [function.pg-connect]: 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_PORT user=3D$PG_USER password=3D$PG_PASS" ); if ( ! $dbconn ) { echo "Error connecting to the database !
" ; 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