简体   繁体   中英

CodeIgniter Tank_auth. Undefined property: Auth::$db

Fresh installation of tank_auth library over Codeigniter 2.1.3.

When I try to access ' http://localhost/es/auth/register ' gets following PHP error:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Auth::$db

Filename: libraries/Session.php

Line Number: 201

Everything seems to be configured and 'autoloaded'.

Edit: My '/application/config/autoload.php' file contains following lines:

$autoload['packages'] = array();
$autoload['libraries'] = array('database', 'session', 'xmlrpc','encrypt');
$autoload['helper'] =  array('url', 'file');
$autoload['config'] = array();
$autoload['language'] = array();
$autoload['model'] = array();

What might be wrong?

What about changing the array elements order? Just try to put 'session' before 'database', It is probably a stupid change - because the codeigniter sample is just like the one you have - but it's the only difference I can see with my environment:

$autoload['libraries'] = array('session', 'database');
$autoload['helper'] = array('array', 'url', 'form', 'string', 'date', 'language', 'static', 'cookie');

If it does not work you can try to manually load the database in the code, just to see any clue:

$this->load->database();

Ah, and take a look that your database settings will be ok in config file:

$config['hostname'] = "localhost";
$config['username'] = "myusername";
$config['password'] = "mypassword";
$config['database'] = "mydatabase";
$config['dbdriver'] = "mysql";

Keep an eye to your log config too:

$config['log_threshold'] = 4;

Maybe some problems related to pconnect? try it with FALSE value. Sorry if it does not help a lot, it's the only stuff that came to my mind.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM