bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.6k forks source link

Session with database inserting data continuously #3661

Closed hellofarhan closed 9 years ago

hellofarhan commented 9 years ago

I am using session with database. Data is inserting continuously. I don't know what is going on.

narfbg commented 9 years ago

What do you mean by continuously?

hellofarhan commented 9 years ago

After configure the session storage as database in testing server I checked the session table. Each and every second the session row is inserting into session table. until now table row is increasing one by one.

narfbg commented 9 years ago

Did you make sure you cookie settings are correct? Specifically the domain and path parts must match those of your site's location.

hellofarhan commented 9 years ago

Yes I checked. It has the default configuration and my domain is not subdomain. And before session driver was cookie with database. on that time it was working perfectly. After upgrading of new version of CI it is happening.

narfbg commented 9 years ago

Did you change your database table structure accordingly then?

hellofarhan commented 9 years ago

Yes of course. I followed all steps from this link http://www.codeigniter.com/userguide3/libraries/sessions.html

narfbg commented 9 years ago

Please post your session and cookie settings.

hellofarhan commented 9 years ago

$config['sess_driver'] = 'database'; $config['sess_cookie_name'] = 'KingSession'; $config['sess_expiration'] = 0; $config['sess_save_path'] = 'king_sessions'; $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE;

$config['cookie_prefix'] = ''"; $config['cookie_domain'] = ''"; $config['cookie_path'] = '/'; $config['cookie_secure'] = FALSE; $config['cookie_httponly'] = FALSE;

narfbg commented 9 years ago

Hmm ... and what is the domain name that you use to access that?

hellofarhan commented 9 years ago

I restarted the server. Still increasing session rows.

hellofarhan commented 9 years ago

After lots of works I found the problem. I am using varnish cache with apache. The problem is if I disable varnish cache everything working fine but if I enable the varnish cache again it is starting to insert session rows each and every second. I am using the following varnish configuration. https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl

narfbg commented 9 years ago

I see ...

Well, you might have more luck if you ask for help on the forums. Closing this now as it is deffinately not a bug.