0
votes

I'm getting this error after fresh install of Joomla 2.5.11 on Xampp 1.8.1:

Fatal error: Call to a member function setDebug() on a non-object in C:\xampp\htdocs\mysite.com\libraries\joomla\factory.php on line 309

The code in that file looks like this:

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 }

I created the database before installation, and if i look into it i can see all joomla tables was created after installation process; so it seems it's not related to database connection problem. So, what could it be?

Note: I checked twice the download from official Joomla site, and i'm sure the package was downloaded correctly.

Update: Just tried Joomla 2.5.9 and got the same error. Something seems to be wrong with my environment (but only for Joomla, Drupal is working ok!)

Update 2: *Following @nibra suggestion, i put *

var_export(self::$database);
exit;

after line 308.

**The output looks like this:

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 ( ),
))

Update 3: the output after commenting exit:

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 ( ),
)) 

Well, there is a little difference:

'_database' => 'psychology',
'connection' => mysqli::__set_state(array( 'affected_rows' => NULL,

instead of

'database' => 'psychology',
'connection' => mysqli::_set_state(array( 'affected_rows' => NULL,

What the hack that means?

3
try downloading a fresh copy of Joomla 2.5.11 and copy the entire libraries folder to your root directory to replace it.Lodder
Did you go through the CMS install process or did you just manually import the database DDL? Do you have a configuration.php file at your Joomla site root?Michael
@Michael I followed the standard install process for Joomla. configuration.php file is there, and it looks ok.Luc

3 Answers

0
votes

$conf->get('debug') is returning an empty value. so, $debug is empty too. As a result setDebug() is getting non-object(empty).Make sure there exists a method getDebug() in your model and if so, check if the model is used with the current module or if the right model is being used.

If it is fresh install, then some part of the relevant code may be missing during the process.

0
votes

The createDbo() method will die or issue a 500 Internal Server Error on problems with the connection. It should never return a non-object.

After line 308, insert

var_export(self::$database);
exit;

to get a hint, what happened to the database object.

Your output of the var_export shows, that there is a valid database object, so the fatal error from the beginning does make sense. Obviously, the problem is either fixed or not occuring everytime.

To trace that down, remove the exit line and re-run the request. If you get the fatal error again, the var_export output should show something different than a JDatabaseMysqli object.

0
votes

Problem solved!

I remembered i changed some settings in php.ini few time ago in order to improve the performance of php. The setting that seems to be responsible for this error seems to be zend eaccelerator:

zend_extension = "C:\xampp\php\ext\php_eaccelerator_ts.dll"

I commented out that line and now everything is ok!

Thanks to all who helped, that kept me motivated in solving this issue :)