#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Chennai
    Posts
    160
    Rep Power
    11

    Angry pg_connect error


    hi

    when i try to connect the postgres i am getting this error .the server is linux


    Warning: pg_connect() unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host 192.100.100.246 and accepting TCP/IP connections on port 5432? in /var/www/html/kalanjali/copytest.php on line 10
    Database connection error.

    the syntax is
    $conn = pg_connect("host=192.100.100.246 dbname=kalanjali port=5432 user=Administrator password=admin");

    here host is 192.100.100.246
    dbname=kalanjali
    port=5432
    user=Administrator
    password=admin

    can anyone help on ths

    waiting for ur kind reply

    chandar
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    373
    Rep Power
    12
    well, is postmaster accepting requests on port 5432? Check the postgresql.conf file and see if the accept tcpip connections is set to true. Are you on a remote host? You need to add that host or subnet to the pg_hba.conf file. Check out the manual page on pg_hba.conf
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Chennai
    Posts
    160
    Rep Power
    11

    same error


    but even after configuring i postgres.conf am getting an error but now the error s diff

    the error is

    Warning: pg_connect() unable to connect to PostgreSQL server: FATAL 1: No pg_hba.conf entry for host 192.100.100.246, user Administrator, database kalanjali in /var/www/html/kalanjali/copytest.php on line 10
    Database connection error.

    i checked in pg_hba.conf file

    there its

    host all 192.100.100.246 255.255.255.0 password

    waiting for ur reply

    chandar.v.rao
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    373
    Rep Power
    12
    try it first with 'trust' in stead of the password. Also, you could try having the subnet mask as 255.255.255.255

    I'm not especially familiar with TCP/IP to say if your subnet is right or mine is but just for troubleshooting purposes give it a shot. Also, I believe in the docs it says a SIGHUP is not sufficient to reload the pg_hba.conf file, you have to do pg_ctl restart or restart the machine and start up postmaster.
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Chennai
    Posts
    160
    Rep Power
    11
    I changed the subnet also

    The error is

    Warning: pg_connect() unable to connect to PostgreSQL server: FATAL 1: No pg_hba.conf entry for host 192.100.100.246, user Administrator, database kalanjali in /var/www/html/kalanjali/copytest.php on line 11
    Database connection error.

    host ALL 192.100.100.246 255.255.255.255 trust

    actually the ip is local ip only

    please can u reply for ths

    chandar.v.r
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Chennai
    Posts
    160
    Rep Power
    11

    thanks


    thanks i have got the answer .

    its connecting now

    chandar.v.r

IMN logo majestic logo threadwatch logo seochat tools logo