Fatal error: Class 'JDatabaseDriver' not found in /home/jensen/public_html/libraries/joomla/factory.php on line 631
I have been searching online for a answer to this problem for two days now.I have spent a lot of time on the joomla forums, but I have not found anything address this issue. Hopefully I can get some direction here.
This error appears when I go to the website http://jensenlocksmithing.com
However, if I type in http:/jensenlocksmithing.com/index.php the error disappears again. That seems really strange to me.
Here's the code block the error is referring to:
/** * Create an database object * * @return JDatabaseDriver * * @see JDatabaseDriver * @since 11.1 */ protected static function 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;
}
I have tried to completely reinstall the joomla installation to fix the problem, and I cleared my cache after, but I still receive the error.
Any suggestions would be helpful.
The following code should work, it is what I used in my Coppermine Photo Gallery image module:
$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;
Hopefully that gets your problem resolved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.