X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5D4E0D1C4D5; Mon, 28 Jul 2003 07:14:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 71631-07; Mon, 28 Jul 2003 04:14:04 -0300 (ADT) Received: from s2bdcmail.goetheanum.ch (unknown [157.161.160.10]) by svr1.postgresql.org (Postfix) with ESMTP id EBB8BD1C4B7; Mon, 28 Jul 2003 04:14:55 -0300 (ADT) Received: by S2BDCMAIL with Internet Mail Service (5.5.2653.19) id <32JA5T87>; Mon, 28 Jul 2003 09:10:40 +0200 Message-ID: From: christoph.dellavalle@goetheanum.ch To: pgsql-novice@postgresql.org, pgsql-php@postgresql.org Subject: Re: Accessing Postgres db from apache using PHP Date: Mon, 28 Jul 2003 09:10:39 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/203 X-Sequence-Number: 7738 I'm not sure, but I think you have to start postgres with the option -i to = allow it to use TCP/IP. if you get a socket error look at the php.ini, sockets.unix_socket_director= y =3D /tmp, go to the directory indicated there and have a look, if there i= s a socket. PHP and postgres both have a setting for the socket directory = and they must be the same. Hope it helps, Christoph Della Valle >-----Urspr=FCngliche Nachricht----- >Von: bruce [mailto:bedouglas@earthlink.net] >Gesendet: Montag, 28. Juli 2003 03:00 >An: pgsql-novice@postgresql.org; pgsql-php@postgresql.org >Betreff: [NOVICE] Accessing Postgres db from apache using PHP > > >Hi... > >I'm new to Postgres... I've installed Postgres on a Linux RH=20 >8.0 server. I'm >trying to access a pgsql db from an Apache website, using=20 >PHP(v-4.2.2). I've >taken a look at google and through the archives with no real luck... > >I created a Linux user and given the user rights to the Postgres group. >I created a Linux user (gforge) and given it rights to the=20 >Postgres group. >Using the gforge user, I created a postgres user, using > -> createuser gforge - W >I gave the user the password of ->gforge > >I gave the user rights to add/create databases, but not add new users >I then installed a database. > pgsql -U gforge -d gforge < gforge3.sql > >At this point, I can see that I have a db in postgres.... >I did a "\l" and it displayed: > name owner encoding >-->> gforge gforge sql_ascii > > >In my php code, I have.... > >$sys_dbhost =3D "localhost"; >$sys_dbname =3D "gforge"; >$sys_user =3D "gforge"; >$sys_dbpasswd =3D "gforge"; > >i then do a: > $tmp =3D "host=3Dlocalhost dbname=3Dgforge user=3Dgforge=20 >password=3Dgforge"; > $conn =3D @pg_connect($tmp); > >at this point $conn is not set... it should be a resouce if=20 >I've connect to >the DB..!!!!!!! > >So.. the question... Anybody have any idea as to what I've=20 >done wrong/left >out/etc... > >Any pointers/comments/criticisms would be helpful..... >Any sample docs, or code that illustrates how this should be=20 >accomplished >would be helpful... > > >Thanks... > >Bruce Douglas >(925) 866-2790 >bedouglas@earthlink.net > > >---------------------------(end of=20 >broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster >