i am getting the following error message -

Warning: 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?

this is my command -

$result = pg_pconnect("host=localhost dbname=db1 user=user1 password=password1");

postgres is running and i can connect to the database db1 ok (manually). the user/password combination user1/password1 exist ok

i think my host is localhost (i am running apache etc. off my local machine.) i do not know how ot check which port postgres is running off

any ideas???

thanks 🙂

    Well.. Apache is on your machine? Did you install PostgreSQL on your machine also? If so did you set it up with TCP/IP? You might be connecting to it via filesockets. (streams/pipe/etc) when you test it. If you have the program "nmap" installed run "nmap localhost" and see if it show the PostgreSQL port as being open. (5432)

    Frag

      here are the results of my nmap -

      [root@tethys sryan]# nmap localhost

      Starting nmap V. 2.54BETA22 ( www.insecure.org/nmap/ )
      Interesting ports on localhost.localdomain (127.0.0.1):
      (The 1537 ports scanned but not shown below are in state: closed)
      Port State Service
      25/tcp open smtp
      80/tcp open http
      111/tcp open sunrpc
      3306/tcp open mysql
      6000/tcp open X11

      ok - so postgres does not seem to be listening. do you know how i go about fixing this?

      thanks for the help 🙂

        need to start postmaster with -i

        AND

        add the following to my pg_hba.conf
        host all 127.0.0.1 255.255.255.255 trust

          Write a Reply...