Accessing Postgres db from apache using PHP

From: "bruce" <bedouglas(at)earthlink(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>, <pgsql-php(at)postgresql(dot)org>
Subject: Accessing Postgres db from apache using PHP
Date: 2003-07-28 01:00:14
Message-ID: 001501c354a3$9aee0b40$0301a8c0@Mesa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-php

Hi...

I'm new to Postgres... I've installed Postgres on a Linux RH 8.0 server. I'm
trying to access a pgsql db from an Apache website, using 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 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 = "localhost";
$sys_dbname = "gforge";
$sys_user = "gforge";
$sys_dbpasswd = "gforge";

i then do a:
$tmp = "host=localhost dbname=gforge user=gforge password=gforge";
$conn = @pg_connect($tmp);

at this point $conn is not set... it should be a resouce if I've connect to
the DB..!!!!!!!

So.. the question... Anybody have any idea as to what I've done wrong/left
out/etc...

Any pointers/comments/criticisms would be helpful.....
Any sample docs, or code that illustrates how this should be accomplished
would be helpful...

Thanks...

Bruce Douglas
(925) 866-2790
bedouglas(at)earthlink(dot)net

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message brew 2003-07-28 02:10:09 Re: Accessing Postgres db from apache using PHP
Previous Message Bruce Momjian 2003-07-27 03:52:03 Re: [NOVICE] connectby(... pos_of_sibling)

Browse pgsql-php by date

  From Date Subject
Next Message brew 2003-07-28 02:10:09 Re: Accessing Postgres db from apache using PHP
Previous Message Michael Vodep 2003-07-27 18:20:30 How to make a BLOB record public!?