Jump to content


Problem connecting to postgres database using php

  • Please log in to reply
1 reply to this topic

#1 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, user apache, database x6a in /var/www/html/veena/test.php on line 2

Couldn\'t connect

My program goes like this:
$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 trust

Any help will be appreciated.

#2 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.


also, when all else fails, try google.

does this help any?

Regexp | Unicode Article | Letter Database

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users