Thread: Help with pg_connect() command.

Help with pg_connect() command.

From
Steve Kershaw
Date:
Hello,

I'm having problems connecting to a postgre database
from my PHP code. The code I'm using is:

  $conn = pg_connect("host=localhost port=5432
dbname=movies ")
  or die("Couldn't make a connection");

And the warning message I get is:

Warning: pg_connect() unable to connect to PostgreSQL
server: could not connect to server: Connection
refused Is the server running on host localhost and
accepting TCP/IP connections on port 5432? in
/var/www/html/testpostgre.php on line 11
Couldn't make a connection

Am I missing anything here? Thanks in advance for your
help.

Steve


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


Re: Help with pg_connect() command.

From
Riza Fahmi
Date:
You must setting postgres to run under localhost. To do that, first
you must edit pg_hba.conf under /var/lib/pgsql/data/ and find:
  # local      all                                          trust
  # host       all         127.0.0.1     255.255.255.255    trust
and then remove the comment('#'), and don't forget to save the file.
Just that.


Riza Fahmi


---Sunday, May 11, 2003, 6:20:54 AM, pgsql-novice@postgresql.org wrote:

SK> Hello,

SK> I'm having problems connecting to a postgre database
SK> from my PHP code. The code I'm using is:

SK>   $conn = pg_connect("host=localhost port=5432
SK> dbname=movies ")
SK>   or die("Couldn't make a connection");

SK> And the warning message I get is:

SK> Warning: pg_connect() unable to connect to PostgreSQL
SK> server: could not connect to server: Connection
SK> refused Is the server running on host localhost and
SK> accepting TCP/IP connections on port 5432? in
SK> /var/www/html/testpostgre.php on line 11
SK> Couldn't make a connection

SK> Am I missing anything here? Thanks in advance for your
SK> help.

SK> Steve


SK> __________________________________
SK> Do you Yahoo!?
SK> The New Yahoo! Search - Faster. Easier. Bingo.
SK> http://search.yahoo.com


SK> ---------------------------(end of broadcast)---------------------------
SK> TIP 4: Don't 'kill -9' the postmaster