Jump to content

Recommended Posts

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.

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/manual/en/function.pg-connect.php

 

also, when all else fails, try google.

 

does this help any?

 

http://www.vmlinuz.ca/archives/expert/2002...7/msg00910.html

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.