DB错误,扩展未找到

时间:2021-10-28 07:18:23

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:

我正在尝试在我们的web服务器上安装phpBugTracker。当我尝试在安装屏幕上测试数据库连接时,我得到一个错误屏幕,上面写着“DB测试失败……”DB错误:扩展未找到”。从以下函数抛出错误:

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/'>http://pear.php.net/</a>";
        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.

我正在使用MySQL版本5.0.45,PHP版本4.47,并且我有PEAR::DB版本1.7.6稳定。我已经验证过,我可以通过创建的登录名连接到正在使用的数据库。至于安装了哪些模块,我完全听命于我的托管公司。

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.

编辑:db_type设置为“mysqli”。当我使用“mysql”作为类型时,我得到的是“连接失败”错误。

2 个解决方案

#1


2  

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')?

使用phpinfo()验证正在使用的db_type扩展是否已安装并激活。也许您正在尝试使用“mysqli”db_type,而应该使用“mysql”(没有“i”)?

MySQLi doesn't come by default with PHP4.

MySQLi默认不支持PHP4。

#2


2  

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.

我觉得有点傻,但是MySQL的路径在这个特定的服务器上是不同的,我假设是localhost。这与mysql和mysqli没有关系。固定路径和它连接的很好。

#1


2  

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')?

使用phpinfo()验证正在使用的db_type扩展是否已安装并激活。也许您正在尝试使用“mysqli”db_type,而应该使用“mysql”(没有“i”)?

MySQLi doesn't come by default with PHP4.

MySQLi默认不支持PHP4。

#2


2  

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.

我觉得有点傻,但是MySQL的路径在这个特定的服务器上是不同的,我假设是localhost。这与mysql和mysqli没有关系。固定路径和它连接的很好。