Can't connect to 7.4 DB

From: Michael Hanna <taojones(at)sympatico(dot)ca>
To: pgsql-php(at)postgresql(dot)org
Subject: Can't connect to 7.4 DB
Date: 2004-02-12 13:36:45
Message-ID: 80431890-5D60-11D8-B81E-000A95B34330@sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-php

Hi this php code:


// add to DB

// database access parameters
$host = "localhost";
$user = "postgres";
$pass = "postgres";
$db = "cosc3p94";

// open a connection to the database server
$connection = pg_connect("host=$host dbname=$db user=$user
password=$pass");

if (!$connection)
{
die("Could not open connection to database server");
}

...

results in:

Could not open connection to database server

and I'm not sure why. The web browser, web server, and database are on
the same machine..

I checked the pg_hba.conf and it says this:

# TYPE DATABASE USER IP-ADDRESS IP-MASK
METHOD

local all all
trust
# IPv4-style local connections:
host all all 127.0.0.1 255.255.255.255
trust
# IPv6-style local connections:
host all all ::1
ffff:ffff:ffff:ffff:ffff:ffff:ff$

which is untouched from the default settings...

Michael

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message scott.marlowe 2004-02-12 15:08:42 Re: I want to use postresql for this app, but...
Previous Message Chris Travers 2004-02-12 13:08:52 Re: I want to use postresql for this app, but...

Browse pgsql-php by date

  From Date Subject
Next Message scott.marlowe 2004-02-12 15:30:17 Re: Can't connect to 7.4 DB
Previous Message David Costa 2004-02-11 22:22:21 PHP/PostGreSQL Articles