Jump to content


Photo

Problem connecting to postgres database using php


  • Please log in to reply
1 reply to this topic

#1 veenasv

veenasv
  • Members
  • Pip
  • Newbie
  • 5 posts
  • LocationNewyork,USA

Posted 24 January 2003 - 10:52 PM

I have installed Mandrake8.2 . And decided to use postgresql with php for web page development. and the webserver is apache. Mandrake is bundled with postgres, php. So, am using the same. I wrote a simple program to conenct to the postgres database using php. But it gives following error:

Warning: Unable to connect to PostgreSQL server: FATAL 1: No pg_hba.conf entry for host 127.0.0.1, user apache, database x6a in /var/www/html/veena/test.php on line 2

Couldn\'t connect

My program goes like this:
<?php
$connection = pg_Connect( \"host=localhost dbname=x6a\" )
or die(\"Couldn\'t connect\");
$result = pg_exec($connection, \"SELECT * FROM addresses;\")
or die(\"couldn\'t execute\");
?>

I have granted all previleges to user apache in my addresses table in x6a database. I also have entry in pg_hba.conf as:

local all trust
localhost all 127.0.0.1 255.255.255.255 trust

Any help will be appreciated.

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 27 January 2003 - 09:00 PM

i don\'t think many of us forum-goers are familiar with postgre...

here is the manual entry for pg_connect — sift through the user contributed notes and see if anything helps.

http://www.php.net/m....pg-connect.php

also, when all else fails, try google.

does this help any?

http://www.vmlinuz.c...7/msg00910.html
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users