簡體   English   中英

致命錯誤:找不到類“ JDatabaseDriver”

[英]Fatal error: Class 'JDatabaseDriver' not found

Fatal error: Class 'JDatabaseDriver' not found in /home/jensen/public_html/libraries/joomla/factory.php on line 631

我已經在網上搜索此問題的答案已有兩天了。我已經在joomla論壇上花了很多時間,但沒有找到任何解決此問題的方法。 希望我能在這里得到一些指導。

當我轉到網站http://jensenlocksmithing.com時出現此錯誤

但是,如果我輸入http:/jensenlocksmithing.com/index.php,該錯誤會再次消失。 這對我來說真的很奇怪。

這是錯誤所指的代碼塊:

/ ** *創建數據庫對象* * @return JDatabaseDriver * * @see JDatabaseDriver * @since 11.1 * /受保護的靜態函數createDbo(){$ conf = self :: getConfig();

    $host = $conf->get('host');
    $user = $conf->get('user');
    $password = $conf->get('password');
    $database = $conf->get('db');
    $prefix = $conf->get('dbprefix');
    $driver = $conf->get('dbtype');
    $debug = $conf->get('debug');

    $options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);

    try
    {
        $db = JDatabaseDriver::getInstance($options);
    }
    catch (RuntimeException $e)
    {
        if (!headers_sent())
        {
            header('HTTP/1.1 500 Internal Server Error');
        }

        jexit('Database Error: ' . $e->getMessage());
    }

    $db->setDebug($debug);

    return $db;
}

我試圖完全重新安裝joomla安裝程序以解決此問題,此后我清除了緩存,但仍然收到錯誤消息。

任何的意見都將會有幫助。

以下代碼應該可以工作,這就是我在Coppermine Photo Gallery圖像模塊中使用的代碼:

$config = JFactory::getConfig();
$option = array();
$option['driver']   = $config->get('dbtype');
$option['host']     = $config->get('host');
$option['user']     = $config->get('user');
$option['password'] = $config->get('password');
$option['database'] = $config->get('db');
$option['prefix']   = $config->get('dbprefix');

//UNCOMMENT THE FOLLOWING LINE TO VIEW OPTIONS ARRAY CONTENTS         
//print_r($option);

$db = JFactory::getDBO();
try
{
    $db = JDatabase::getInstance($option);
}
catch (RuntimeException $e)
{
    JFactory::getApplication()->enqueueMessage($e->getMessage());
    $db->setDebug($debug);
    return false;
}
return $db;

希望可以解決您的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM