首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PEAR::DB错误,未找到扩展

问PEAR::DB错误,未找到扩展
EN

Stack Overflow用户
提问于 2009-03-20 21:13:57
回答 2查看 20.2K关注 0票数 3

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

代码语言:javascript
复制
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;
        }
    }
}

我使用的是MySQL版本5.0.45,PHP4.47,还有PEAR::DBVersion1.7.6稳定。我已经验证了,我可以连接到我正在使用的数据库,而不是我创建的登录。我正在任由我的托管公司决定什么模块是安装的。

有什么可能导致这个错误的想法吗?

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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2009-08-18 20:40:14

好吧,我觉得很傻,但是在这个特定的服务器上,通往MySQL的路径是不同的,我只是假设了本地主机。这与mysql和mysqli没有任何关系。固定的路径连接得很好。

票数 3
EN

Stack Overflow用户

发布于 2009-03-20 21:24:21

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

MySQLi在默认情况下并不随PHP4而来。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/668022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档