PostGres and Installation

Having trouble installing serendipity?
Post Reply
chuckwilliams1
Posts: 2
Joined: Wed Apr 12, 2006 10:55 am
Location: chicago
Contact:

PostGres and Installation

Post by chuckwilliams1 »

I'm at bluehost.com and the only php db connection script I get to work looks like this:
<?
$database = pg_connect("dbname=service5_pg");
if ($database) {
print "Connection \n";
} else {
print "No connection \n";
}
?>
The other parameters all produce errors. This doesn't.
Here's the url: http://box105.bluehost.com/~service5/ce/pg.php

But my serendipity installation requires all the parameters and gives me this error:
Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: IDENT authentication failed for user "service5_admin" in /home/service5/public_html/serendipity/include/db/postgres.inc.php on line 199
Could not connect to database; check your settings.
It's at http://box105.bluehost.com/~service5/se ... _admin.php?

Can you help? I tried re-writing the code at line 99 of postgres.inc.php but I don't know php well enough to pull it off. I'm open to suggestions. I'm not an expert.
---
Chuck Williams
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: PostGres and Installation

Post by garvinhicking »

Your PHP script uses socket authentication, whereas Serendipity needs to use TCP authentication to be compatible to the usual PGSql workage.

So you must edit your pg_hba.conf to enable TCP/IP authentication. It's basically a PGSql configuration issue, not a Serendipity/PHP problem. You might get better help at pgsql specific forums on how to setup pgsql so that it allows TCP connections for PHP scripts.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
huuanito
Posts: 2
Joined: Fri Nov 17, 2006 7:15 am
Location: San Diego,Ca,USA

Re: PostGres and Installation

Post by huuanito »

garvinhicking wrote:Your PHP script uses socket authentication, whereas Serendipity needs to use TCP authentication to be compatible to the usual PGSql workage.

So you must edit your pg_hba.conf to enable TCP/IP authentication. It's basically a PGSql configuration issue, not a Serendipity/PHP problem. You might get better help at pgsql specific forums on how to setup pgsql so that it allows TCP connections for PHP scripts.

HTH,
Garvin
Hi Garvin,

I had the exact same issues during install. Scoured the web and found this post. Unfortunately it didn't help as I'm on shared hosting and don't have access to the postgre conf scripts. I'm also not sure that that is the exact issue as I note that phppgadmin uses TCP/IP to successfully access the same server. I'll have to check into what they do to narrow it down. If I crack the code I'll report back here.

Anyways I found a workaround:
First I made a simple php script to test login to the pg server using pg_connect() and found the same issue. A search on php.net suggested that I leave out the host= in pg_connect and that would cause the connection to use unix domain sockets, so I tried that on my script, not by leaving it out as I saw in the s9y code that it was there, but by setting it to blank host='' and it worked just fine. so I retried the install leaving the host entry blank and it worked there also. :-)
Several questions:
1. is there a downside to this approach, sockets vs tcp/ip? ;
2. can I use a .htaccess file to fix the postgre perms so that it works the way s9y wants; and lastly
3. if you approve the approach in 1. above can a note be made in the install directions to help other folks who have the same issue so they don't have to scour the web for answers.

Thanks for a great piece fo software.

Johnny
huuanito
Posts: 2
Joined: Fri Nov 17, 2006 7:15 am
Location: San Diego,Ca,USA

Post by huuanito »

Well I looked a litle closer at phpPgAdmin on my shared hosting server and saw that it shows entries for:
Server Host Port Username Actions

the server entry is set to PostgreSQL
the Host entry is empty
the Port entry is set to 5432

so it would seem that phpPgAdmin also uses a blank for the Host.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Phew, sadly I know too little of postgresql to be able to provide you with an answer. :-(

I believe that sockets are faster than TCP/IP operations, so that is fine...

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply