在 Xampp 1.8.1 上全新安装 Joomla 2.5.11 后出现此错误:
致命错误:在第 309 行的 C:\xampp\htdocs\mysite.com\libraries\joomla\factory.php 中的非对象上调用成员函数 setDebug()
该文件中的代码如下所示:
300 public static function getDbo()
301 {
302 if (!self::$database)
303 {
304 //get the debug configuration setting
305 $conf = self::getConfig();
306 $debug = $conf->get('debug');
307
308 self::$database = self::createDbo();
309 self::$database->setDebug($debug);
310 }
311
312 return self::$database;
313 }
我在安装之前创建了数据库,如果我查看它,我可以看到所有 joomla 表都是在安装过程之后创建的;所以它似乎与数据库连接问题无关。那么,它可能是什么?
注意: 我检查了两次从 Joomla 官方网站下载的内容,我确定该软件包已正确下载。
更新: 刚刚尝试了 Joomla 2.5.9 并得到了同样的错误。我的环境似乎有问题(但仅适用于 Joomla,Drupal 工作正常!)
更新 2: *遵循@nibra 的建议,我提出 *
var_export(self::$database);
exit;
在第 308 行之后。
**输出如下所示:
JDatabaseMySQLi::__set_state(array( 'name' => 'mysqli',
'nameQuote' => '`',
'nullDate' => '0000-00-00 00:00:00',
'dbMinimum' => '5.0.4',
'database' => 'psychology',
'connection' => mysqli::_set_state(array( 'affected_rows' => NULL,
'client_info' => NULL,
'client_version' => NULL,
'connect_errno' => NULL,
'connect_error' => NULL,
'errno' => NULL,
'error' => NULL,
'error_list' => NULL,
'field_count' => NULL,
'host_info' => NULL,
'info' => NULL,
'insert_id' => NULL,
'server_info' => NULL,
'server_version' => NULL,
'stat' => NULL,
'sqlstate' => NULL,
'protocol_version' => NULL,
'thread_id' => NULL,
'warning_count' => NULL,
)),
'count' => 0,
'cursor' => NULL,
'debug' => false,
'limit' => 0,
'log' => array ( ),
'offset' => 0,
'sql' => NULL,
'tablePrefix' => 'fqd1p_',
'utf' => true,
'errorNum' => 0,
'errorMsg' => NULL,
'hasQuoted' => false,
'quoted' => array ( ),
))
更新3:评论退出后的输出:
JDatabaseMySQLi::__set_state(array( 'name' => 'mysqli',
'nameQuote' => '`',
'nullDate' => '0000-00-00 00:00:00',
'dbMinimum' => '5.0.4',
'_database' => 'psychology',
'connection' => mysqli::__set_state(array( 'affected_rows' => NULL,
'client_info' => NULL,
'client_version' => NULL,
'connect_errno' => NULL,
'connect_error' => NULL,
'errno' => NULL,
'error' => NULL,
'error_list' => NULL,
'field_count' => NULL,
'host_info' => NULL,
'info' => NULL,
'insert_id' => NULL,
'server_info' => NULL,
'server_version' => NULL,
'stat' => NULL,
'sqlstate' => NULL,
'protocol_version' => NULL,
'thread_id' => NULL,
'warning_count' => NULL,
)),
'count' => 0,
'cursor' => NULL,
'debug' => false,
'limit' => 0,
'log' => array ( ),
'offset' => 0,
'sql' => NULL,
'tablePrefix' => 'fqd1p_',
'utf' => true,
'errorNum' => 0,
'errorMsg' => NULL,
'hasQuoted' => false,
'quoted' => array ( ),
))
嗯,有一点不同:
'_database' => 'psychology',
'connection' => mysqli::__set_state(array( 'affected_rows' => NULL,
代替
'database' => 'psychology',
'connection' => mysqli::_set_state(array( 'affected_rows' => NULL,
这意味着什么?