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 AA38E11F6106 for ; Mon, 3 Apr 2006 17:03:36 -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 69785-06 for ; Mon, 3 Apr 2006 17:03:32 -0300 (ADT) X-Greylist: delayed 00:06:39.509786 by SQLgrey- Received: from pb78.olsztyn.sdi.tpnet.pl. (pb78.olsztyn.sdi.tpnet.pl [213.76.235.78]) by postgresql.org (Postfix) with ESMTP id B6BF611F660D for ; Mon, 3 Apr 2006 17:03:29 -0300 (ADT) Received: (qmail 9825 invoked by uid 1000); 3 Apr 2006 22:01:23 +0200 Date: Mon, 3 Apr 2006 22:01:23 +0200 From: Mariusz =?iso-8859-2?Q?P=EAkala?= To: pgsql-php@postgresql.org Subject: Re: Unable to connect to PostgreSQL Server: Permission denied Message-ID: <20060403200123.GB9357@cthulhu.sdi.tpnet.pl> Mail-Followup-To: pgsql-php@postgresql.org References: <20060403170611.19617.qmail@webmail47.rediffmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uQr8t48UFsdbeI+V" Content-Disposition: inline In-Reply-To: <20060403170611.19617.qmail@webmail47.rediffmail.com> User-Agent: Mutt/1.5.11 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/2 X-Sequence-Number: 3472 --uQr8t48UFsdbeI+V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2006-04-03 17:06:11 -0000 (Mon, Apr), muralidhar sortur wrote: > =20 > Hi , > Here is the complete description of the problem ... >=20 > I have newly installed fedora core 4 with option as everyting. [...] > ------------------------------------------------------------- > Error i get is > [client 127.0.0.1] PHP Warning: 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 How does the file /tmp/.s.PGSQL.* look like? Does 'www' user have access to it? ls -l /tmp/.s.PGSQL.* As you enabled network interface in postgresql, you may try to add 'host=3D127.0.0.1' to your pg_connect function. This should let 'www' user to connect. > [root@localhost html]# telnet localhost 5432 > Trying 127.0.0.1... > Connected to localhost.localdomain (127.0.0.1). > Escape character is '^]'. >=20 >=20 > Connection closed by foreign host. >=20 > data/pg_log/postgresql-Mon.log contains >=20 > LOG: invalid length of startup packet Telnet is not the best tool for binary protocols. You may try netcat (nc), but anyway - this test is not significant here. By the way, you used this construction: > $Name=3D$_GET['Name']; > $Email=3D$_GET['Email']; > $Phone=3D$_GET['Phone']; >=20 > $query =3D "INSERT INTO Addresses VALUES( '$Name', '$Phone', '$Email' );"; Forgive me if that is only because this is test, and you know that, but I just HAVE to say: Don't let the untrusted parameters to go into query. Someone may call your page like this: http://example.com/add-entry.php?Email=3Da'); delete from Addresses; -- As *MINIMAL* precaution use: $Name =3D pg_escape_string( $_GET['Name'); --=20 No virus found in this outgoing message. Checked by "grep -i virus $MESSAGE" Trust me. --uQr8t48UFsdbeI+V Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFEMX8TIzblgXdKMIURAvB8AKCVmy45QPOfaGD5HHDg6f6BVJlaNACgu7Cc yvIgquNLb3eNvwVa2AK2rfM= =r9kI -----END PGP SIGNATURE----- --uQr8t48UFsdbeI+V--