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 2623011F6315 for ; Tue, 4 Apr 2006 02:13:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 89906-07 for ; Tue, 4 Apr 2006 02:13:09 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from nediam.com.mx (unknown [69.93.89.140]) by postgresql.org (Postfix) with SMTP id 7352311F6272 for ; Tue, 4 Apr 2006 02:13:08 -0300 (ADT) Received: (qmail 11287 invoked from network); 4 Apr 2006 05:13:07 -0000 Received: from unknown (HELO mail.nediam.com.mx) (127.0.89.140) by nediam.com.mx with SMTP; 4 Apr 2006 05:13:07 -0000 Received: from 201.139.153.195 (SquirrelMail authenticated user nediam) by mail.nediam.com.mx with HTTP; Tue, 4 Apr 2006 00:13:07 -0500 (CDT) Message-ID: <65133.201.139.153.195.1144127587.squirrel@mail.nediam.com.mx> In-Reply-To: <20060403170611.19617.qmail@webmail47.rediffmail.com> References: <20060403170611.19617.qmail@webmail47.rediffmail.com> Date: Tue, 4 Apr 2006 00:13:07 -0500 (CDT) Subject: Re: Unable to connect to PostgreSQL Server: Permission denied From: "Javier Carlos" To: "muralidhar sortur" Cc: pgsql-php@postgresql.org User-Agent: SquirrelMail/1.4.6 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal 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: 200604/3 X-Sequence-Number: 3473 Did you try to restart the PosgreSQL server using pg_ctl ? $ pg_ctl restart Are you able to connect as user from the command line? $ psql AddressBook www Regards, Javier > > Hi , > Here is the complete description of the problem ... > > I have newly installed fedora core 4 with option as everyting. > > it comes with apache webserver, postgresql , php-postgresql, php-gd etc, > > it creates a default user postgres with home = /var/lib/psql > > 1. i loged in as postgres > > 2. called initdb > created database under directory ~/data > > 3. changed postgresql.conf to include > listen_addresses = '*' > port = 5432 > > 4. changed pg_hba.conf > local all all trust > host all all 127.0.0.1/32 trust > host all all 192.168.1.18/24 trust > host all all ::1/128 trust > > 5. postmaster -i -D ~/data & > > 6. createdb AddressBook > > 7. psql AddressBook > > 8. create table addresses( Name text, Phone text, Email text); > > 9. create user www NOCREATEDB NOCREATEUSER; > > 10. grant all on addresses to www; > > 11. from other terminal i loged in as root > > 12. changed /etc/httpd/conf/httpd.conf > > User www > Group postgres > > 13. copied add.html and add-entry.php into directory /var/www/html > > add.html > ------------------------------------------------------ > > > >
> > > > > >
> > > > > > > > > > > > > > > > >
Name
Phone
E-mail
> >
>
>
> > > > -------------------------------------------------- > add-entry.php > -------------------------------------------------- > > > > $db = pg_Connect( "dbname=AddressBook user=www"); > if( !$db ) > { > echo "Could not connect!"; > exit; > } > > $Name=$_GET['Name']; > $Email=$_GET['Email']; > $Phone=$_GET['Phone']; > > $query = "INSERT INTO Addresses VALUES( '$Name', '$Phone', '$Email' );"; > > $result = pg_Exec( $db, $query ); > > if( !$result ) > { > echo "No result set returned!"; > exit; > } > > $rows = pg_NumRows( $result ); > > if( $rows = 0 ) > { > echo "Add Failed."; > exit; > } > > $query = "SELECT * FROM Addresses WHERE \"Name\" = '$Name';"; > > $query = "SELECT * FROM Addresses WHERE \"Name\" = '$Name';"; > > $result = pg_Exec( $db, $query ); > $row = pg_Fetch_Row( $result, 0 ); > > $nameResult = $row[0]; > $phoneResult = $row[1]; > $emailResult = $row[2]; > > echo "Name = $nameResult
"; > echo "Phone = $phoneResult
"; > echo "E-mail = $emailResult
"; > > pg_Close( $db ); > ?> > >

Add Okay!

> > > > ------------------------------------------------------------- > Error i get is > Mon Apr 03 18:39:53 2006] [notice] Apache/2.0.54 (Fedora) configured -- > resuming normal operations > [Mon Apr 03 18:42:17 2006] [error] [client 127.0.0.1] File does not exist: > /var/www/html/favicon.ico > [client 127.0.0.1] PHP Warning: pg_connect() [ href='function.pg-connect'>function.pg-connect]: Unable to connect to > PostgreSQL server: could not connect to server: Permission denied\n\tIs > the server running locally and accepting\n\tconnections on Unix domain > socket "/tmp/.s.PGSQL.5432"? in /var/www/html/add-entry.php on > line 5, referer: http://localhost/add.html > [Mon Apr 03 18:42:22 2006] [error] [client 127.0.0.1] File does not exist: > /var/www/html/favicon.ico > > _______________________________________________________ > > from the command line it works fine > i.e php add-entry.php works fine ( ofcourse adds an empty row into the > data base) > > -------------------------------------------------- > > i did telnet > > [root@localhost html]# telnet localhost 5432 > Trying 127.0.0.1... > Connected to localhost.localdomain (127.0.0.1). > Escape character is '^]'. > > > Connection closed by foreign host. > > data/pg_log/postgresql-Mon.log contains > > LOG: invalid length of startup packet > > > > ------------------------------- > > > I am not getting any clue as to how to solve this problem ...let me know > if you have any idea in solving this porblem. > > regards > Muralidhar > > > ------------- nediam.com.mx