tags:

views:

1748

answers:

2

I am attempting to install phpBugTracker on our web server. When I attempt to test the database connection on the installation screen, I get an error screen that reads "DB Test Failure... DB Error: extension not found". The error is being thrown from the following function:

function test_database(&$params, $testonly = false) {
    // PEAR::DB
    define('PEAR_PATH', ''); // Set this to '/some/path/' to not use system-wide PEAR
    // define('PEAR_PATH', 'inc/pear/'); // use a locally installed Pear (phpBT v0.9.1)
    if (!@include_once(PEAR_PATH.'DB.php')) {
     $error_message = translate("Failed loading Pear:DB");
     $error_info = translate("Please check your Pear installation and the defined PEAR_PATH in install.php");
     $error_info .= " <a href='http://pear.php.net/'&gt;http://pear.php.net/&lt;/a&gt;";
     include('templates/default/install-dbfailure.html');
     exit;
    }
    // execution gets this far without a problem...
    $dsn = array(
     'phptype' => $params['db_type'],
     'hostspec' => $params['db_host'],
     'database'  => $params['db_database'],
     'username'  => $params['db_user'],
     'password'  => $params['db_pass']
     );
    $db = DB::Connect($dsn);

    // Simple error checking on returned DB object to check connection to db
    if (DB::isError($db)) {
       // $db go boom...
     $error_message = isset($db->message) ? $db->message : '';
     $error_info = isset($db->user_info) ? $db->user_info : '';
     include('templates/default/install-dbfailure.html');
     exit;
    } else {
     if ($testonly) {
      include('templates/default/install-dbsuccess.html');
      exit;
     } else {
      return $db;
     }
    }
}

I am using MySQL version 5.0.45, PHP version 4.47, and I have PEAR::DB version 1.7.6 stable. I've already verified that I can connect to the database I'm using with the login I've created otherwise. I am at the mercy of my hosting company as to what modules are installed.

Any ideas on what could be causing the error?

Edit: db_type is set to "mysqli". When I use "mysql" as the type I get a "connection failed" error instead.

+2  A: 

Verify with phpinfo() that extension for db_type you're using is installed and activated. Perhaps you're trying with "mysqli" db_type, while you should use "mysql" (without 'i')?

MySQL**i** doesn't come by default with PHP4.

vartec
When I try using "mysql" instead of "mysqli" I get a "connect failed" error instead.
Heather
Ahhhh - I did not know that. I think my server can use either version, I'll have to try under version 5.x
Heather
A: 

Okay, I feel rather silly, but the path to MySQL was different on this particular server and I had just assumed localhost. This had nothing to do mysql vs. mysqli. Fixed path and it connected just fine.

Heather