pg_connect() unable to connect to pgsql server

From: ATest(at)sbsdk12(dot)org (Coutts, Ashe (Testing Account))
To: pgsql-novice(at)postgresql(dot)org
Subject: pg_connect() unable to connect to pgsql server
Date: 2002-11-20 23:22:43
Message-ID: 3DDBA8C3.6906.2531F48B@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sbceo(dot)k12(dot)ca(dot)us)
805.963.7751 Ext 260
Fax 805.884.1557

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Graham Bartlett 2002-11-21 00:49:28 What is the maximum amount of connections a postgres database will take
Previous Message Oliver Elphick 2002-11-19 14:59:02 Re: [SQL] Problems invoking psql. Help please.