FAQ
Hey guys,

I am trying to connect to a Postgres database using a PHP script but get the
error:

"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?"

How can I find out which port the Postgres database is using? How can I fix
this?

Many thanks for your help,

Stephen

Search Discussions

  • Eduardo Vázquez Rodríguez at Apr 6, 2005 at 2:18 pm
    If you are using a *Nix architechture then look for a file called
    "postgresql.conf", in the contents of that file you should see a lines
    that look like this:

    # - Connection Settings -

    listen_addresses = '*' # what IP interface(s) to listen on;
    # defaults to localhost, '*' = any
    port = 5432
    max_connections = 25


    Then you can see on which port the database is running.

    If you are coming from a fresh installation be sure that the file called
    pg_hba.conf has the appropiate setting allowing network connections.



    SG Edwards wrote:
    Hey guys,

    I am trying to connect to a Postgres database using a PHP script but get the
    error:

    "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?"

    How can I find out which port the Postgres database is using? How can I fix
    this?

    Many thanks for your help,

    Stephen

    ---------------------------(end of broadcast)---------------------------
    TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

    --
    If I have seen further it is by standing on the shoulders of the giants
    Isaac Newton
  • Andreas Kretschmer at Apr 6, 2005 at 2:22 pm

    am 06.04.2005, um 14:48:19 +0100 mailte SG Edwards folgendes:

    Hey guys,

    I am trying to connect to a Postgres database using a PHP script but get the
    error:

    "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?"

    How can I find out which port the Postgres database is using? How can I fix
    this?
    Please read the manual for ph_hba.conf. You must configure your
    pg-server to listen on tcp.

    Check it with netstat.


    Regards, Andreas.
    --
    Andreas Kretschmer (Kontakt: siehe Header)
    Heynitz: 035242/47212, D1: 0160/7141639
    GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
    === Schollglas Unternehmensgruppe ===

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedApr 6, '05 at 1:48p
activeApr 6, '05 at 2:22p
posts3
users3
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase