veenasv Posted January 24, 2003 Share Posted January 24, 2003 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. Link to comment https://forums.phpfreaks.com/topic/90-problem-connecting-to-postgres-database-using-php/ Share on other sites More sharing options...
effigy Posted January 27, 2003 Share Posted January 27, 2003 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 Link to comment https://forums.phpfreaks.com/topic/90-problem-connecting-to-postgres-database-using-php/#findComment-273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.