pg_connect() unable to connect to pgsql server - Mailing list pgsql-novice

From ATest@sbsdk12.org (Coutts, Ashe (Testing Account))
Subject pg_connect() unable to connect to pgsql server
Date
Msg-id 3DDBA8C3.6906.2531F48B@localhost
Whole thread Raw
Responses Re: pg_connect() unable to connect to pgsql server
List pgsql-novice
Sorry about this -- I know its been asked a bunch and
I've read much of what's been posted but I am unable
to get my connection working. So ...



My goal is to use apache with php to extract and display data from pg.

==== My attempts fail with the following =========
Warning: pg_connect() unable to connect to PostgreSQL server:
could not connect to server: Connection timed out Is the server
running on host localhost and accepting TCP/IP connections
on port 5432? in /usr/www/site.admin/htdocs/sasixp/test.php
on line 21 An error occured with the connection.

===== the line 21 in a php script that fails is =====
$database = pg_connect ("host=localhost  user=postgres  dbname=xbase");

=== The next lines comprise the one line that is in my
/etc/rc.d/init.d/postgresql file: ==============
su -l postgres -s  /bin/sh -c "/usr/bin/pg_ctl -o -i -D $PGDATA
-p /usr/bin/postmaster start
> /dev/null 2>&1" < /dev/null
=== End lines forming /etc/rc.d/init.d/postgresql ==

So the -i is there, no?
OR is it in the wrong place?

===== running "netstat -an | grep 5432" === displays:
tcp            0           0 0.0.0.0:5432            0.0.0.0:*               LISTEN
unix  2      [ ACC ]     STREAM     LISTENING     9934   /tmp/.s.PGSQL.5432

==== Line from /var/lib/pgsql/data/pg_hba.conf =======
local      all                                          trust

==== Line from /var/lib/pgsql/data/postgresql.conf
tcpip_socket = true

=============================
I don't understand what to try next.
Any suggestions would be GREATLY appreciated
"Experience is not what happens to you, it
 is what you do with what happens to you"
       -- Aldous Huxley (1894-1963)

   Ashe Coutts (ashe@sbceo.k12.ca.us)
   805.963.7751 Ext 260
   Fax 805.884.1557


pgsql-novice by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: [SQL] Problems invoking psql. Help please.
Next
From: "paul butler"
Date:
Subject: Re: pg_connect() unable to connect to pgsql server