Welcome Guest, Not a member yet? Register   Sign In
CI 1.7.3 Session DB storage not work?
#1

[eluser]trung.le[/eluser]
Hi all

I was trying to work out why Session in my app doesn't store in DB by going through post by post on the forum. However I could not find the answer. So I create this post and hope CI core team/gurus out there could shed some light for me.

My system spec is PHP 5.3.4, CI 1.7.3, MySQL 5.0

1. Create 'ci_sessions' table in MySQL and tested manually with SQL - done
2. Config setting:
- $config['sess_use_database'] = TRUE;
- $config['sess_table_name'] = 'ci_sessions";
3. Create a test class with code:

$newdata = array(
'username' => 'johndoe',
'email' => '[email protected]',
'logged_in' => TRUE
);

$this->session->set_userdata($newdata);

I also turn on profiler to see if there is any SQL queries, unfortunately there is no query reported.

Maybe I have overlooked some important details?

Thank you in advance
#2

[eluser]cideveloper[/eluser]
Crazy question but have you loaded the session class?

Code:
$this->load->library('session');
#3

[eluser]trung.le[/eluser]
[quote author="cideveloper" date="1295336468"]Crazy question but have you loaded the session class?

Code:
$this->load->library('session');
[/quote]

I have set it in autoload.php
#4

[eluser]iloveci[/eluser]
Your regular database connection settings correct?
#5

[eluser]InsiteFX[/eluser]
Did you configure your application/config/database.php settings?

Also with PHP 5.3 there is a bug in MySQL!

$db need to be this:
$db['default']['hostname'] = '127.0.0.1';

And not:
$db['default']['hostname'] = 'localhost';

If running on localhost system.

InsiteFX
#6

[eluser]trung.le[/eluser]
[quote author="InsiteFX" date="1295354363"]Did you configure your application/config/database.php settings?

Also with PHP 5.3 there is a bug in MySQL!

$db need to be this:
$db['default']['hostname'] = '127.0.0.1';

And not:
$db['default']['hostname'] = 'localhost';

If running on localhost system.

InsiteFX[/quote]

When I do Active record query, all are correctly written into DB so I think my db conf is correct. Anyway, I did change to 127.0.0.1 but still it doesn't work.
#7

[eluser]WanWizard[/eluser]
Have you enabled all error reporting and display errors in your php.ini? log_threshold in config.php set to 4?

If you have enabled the use of the database, but no record is created, the only logical explaination is an error that isn't displayed. Did you check your logs ( CI log and Apache log) for error messages?




Theme © iAndrew 2016 - Forum software by © MyBB