Non-Default DB Port!

Having trouble installing serendipity?
Post Reply
NicZak
Regular
Posts: 8
Joined: Thu Jan 11, 2007 8:19 pm

Non-Default DB Port!

Post by NicZak »

During my Serendipity installation I keep getting the error msg: "Could not connect to database; check your settings." I am sure this is because I am running Postgres on a non-standard port. I tried putting "localhost:5434" in the 'Database Host' section of the config, but no luck. How can I configure serendipity to connect on the non-standard port?

Thanks.

- Nick
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Non-Default DB Port!

Post by garvinhicking »

Hi!

Could you try to put "localhost,port=5434" instead?

Do you get other PHP applications to work with your pgsql application? If they also don't work it might be a matter of the postgresql daemon which might not be listening on the localhost domain for connections?

Best regards,
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/
NicZak
Regular
Posts: 8
Joined: Thu Jan 11, 2007 8:19 pm

Post by NicZak »

I really don't know PHP, but I thought I would have no problem hacking the code below to connect on 5434, what am I doing wrong? What needs to be added and where?

Code: Select all

function serendipity_db_connect() {
    global $serendipity;
 
    if (isset($serendipity['dbPersistent']) && $serendipity['dbPersistent']) {
        $function = 'pg_pconnect';
    } else {
        $function = 'pg_connect';
    }
   
    $serendipity['dbConn'] = $function(
                               sprintf(
                                 '%sdbname=%s user=%s password=%s',
                                 strlen($serendipity['dbHost']) ? ('host=' . $serendip$
                                 $serendipity['dbName'],
                                 $serendipity['dbUser'],
                                 $serendipity['dbPass']
                               )
                             );
        
    return $serendipity['dbConn'];
}
I assume the postgresql daemon is running, db connections are all live, is there a way to check that its running for sure? Oh and btw: On my system the command is not psql its psqld, is that going to require me to make changes to any part of the config?

Thanks Garvin.

- Nick
NicZak
Regular
Posts: 8
Joined: Thu Jan 11, 2007 8:19 pm

Post by NicZak »

I really don't know PHP, but I thought I would have no problem hacking the code below to connect on 5434, what am I doing wrong? What needs to be added and where?

Code: Select all

function serendipity_db_connect() {
    global $serendipity;
 
    if (isset($serendipity['dbPersistent']) && $serendipity['dbPersistent']) {
        $function = 'pg_pconnect';
    } else {
        $function = 'pg_connect';
    }
   
    $serendipity['dbConn'] = $function(
                               sprintf(
                                 '%sdbname=%s user=%s password=%s',
                                 strlen($serendipity['dbHost']) ? ('host=' . $serendip$
                                 $serendipity['dbName'],
                                 $serendipity['dbUser'],
                                 $serendipity['dbPass']
                               )
                             );
        
    return $serendipity['dbConn'];
}
I assume the postgresql daemon is running, db connections are all live, is there a way to check that its running for sure? Oh and btw: On my system the command is not psql its psqld, is that going to require me to make changes to any part of the config?

Thanks Garvin.

- Nick
NicZak
Regular
Posts: 8
Joined: Thu Jan 11, 2007 8:19 pm

Post by NicZak »

Sorry for double post! Not sure how I managed to do that!

- Nick
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Are other PHP applications working on your system with Postgresql?

Before we start hacking the s9y code, we should make sure your postgresql actually works with PHP...

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/
NicZak
Regular
Posts: 8
Joined: Thu Jan 11, 2007 8:19 pm

Post by NicZak »

Garvin: Good idea, I agree it makes sense to establish that PHP is working in conjunction with Postgres prior to modifying the code. Is there a standard method of testing to determine whether or not we are good to go? Thanks Garvin, you do great work.

- Nick
NicZak
Regular
Posts: 8
Joined: Thu Jan 11, 2007 8:19 pm

Post by NicZak »

Garvin: Sorry for replying to myself here, but I just thought I'd save you from wasting your time, I spoke w/ our sysadmin here and he informed me that the Pg PHP modules are installed on the public server but not on the development server. As you may have already guessed I want to host my blog on my dev server, so I will get those modules loaded up and proceed forward! Thanks for all of your hard work and I look forward to our future interactions.

Take good care.

- Nick
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi Nick!

Thanks for the update. I guess in that case things should resolve themselves. :-)

Best regards,
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