[英]Fatal error: Class 'JDatabaseDriver' not found
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. 我已经在网上搜索此问题的答案已有两天了。我已经在joomla论坛上花了很多时间,但没有找到任何解决此问题的方法。 Hopefully I can get some direction here.
希望我能在这里得到一些指导。
This error appears when I go to the website http://jensenlocksmithing.com 当我转到网站http://jensenlocksmithing.com时出现此错误
However, if I type in http:/jensenlocksmithing.com/index.php the error disappears again. 但是,如果我输入http:/jensenlocksmithing.com/index.php,该错误会再次消失。 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(); / ** *创建数据库对象* * @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;
}
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. 我试图完全重新安装joomla安装程序以解决此问题,此后我清除了缓存,但仍然收到错误消息。
Any suggestions would be helpful. 任何的意见都将会有帮助。
The following code should work, it is what I used in my Coppermine Photo Gallery image module: 以下代码应该可以工作,这就是我在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;
Hopefully that gets your problem resolved. 希望可以解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.