Support » Plugin: PostgreSQL for WordPress (PG4WP) » [Plugin: PostgreSQL for WordPress (PG4WP)] Alternative port in conection

  • Resolved malguzt


    I changed driver_pgsql.php to allow an alternative port in connection. Now can connect with host:port

    function wpsql_connect($dbserver, $dbuser, $dbpass) {
    $GLOBALS[‘pg4wp_connstr’] = ”;
    if (!empty($dbserver)) {
    $hostAndPort = explode(‘:’, $dbserver);
    $GLOBALS[‘pg4wp_connstr’] .= ‘ host=’ . $hostAndPort[0];
    $GLOBALS[‘pg4wp_connstr’] .= ‘ port=’ . $hostAndPort[1];

    if (!empty($dbuser))
    $GLOBALS[‘pg4wp_connstr’] .= ‘ user=’ . $dbuser;
    if (!empty($dbpass))
    $GLOBALS[‘pg4wp_connstr’] .= ‘ password=’ . $dbpass;
    elseif (!PG4WP_INSECURE)
    wp_die(‘Connecting to your PostgreSQL database without a password is considered insecure.

    If you want to do it anyway, please set “PG4WP_INSECURE” to true in your “db.php” file.’);

    // While installing, we test the connection to ‘template1’ (as we don’t know the effective dbname yet)
    if (defined(‘WP_INSTALLING’) && WP_INSTALLING)
    return wpsql_select_db(‘template1’);

    return 1;

Viewing 1 replies (of 1 total)
  • Plugin Author hawk__


    Hi !

    You don’t tell which version of PG4WP you were using, so I assume 1.2.2 (which was the latest stable version when you posted)…

    I’ve integrated a similar patch in PG4WP 1.3.0b1 and so the new stable version (released earlier today) has it included 🙂

    Anyway, thank you for your effort, please keep me informed if you have any issue using PG4WP.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: PostgreSQL for WordPress (PG4WP)] Alternative port in conection’ is closed to new replies.