![]() |
changing session driver to database (modified) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: changing session driver to database (modified) (/showthread.php?tid=70855) |
changing session driver to database (modified) - richb201 - 06-09-2018 I have a working application that uses the default session driver. Here is my config.php section: $config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = /localhost/ $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE; I am going to move this app from my localhost to a public hoster. Since only absolute paths to the session files are supported when using the files driver I NEED to change over to use the database session driver. I'd like to make this as painless as possible without any fancy modifications. Can someone tell me what is the minimum that I MUST do to make this work? Yes, I read the documentation. General pointers would be very helpful so I can zero in on what needs to be done. Another possibility is to use the files driver but to point the sess_save_path to somewhere within my application directory. But what do I do about the "absolute path" requirement then? thx NOTE: this is the actual config.php: $config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'cisession'; $config['sess_expiration'] = 28800; // this is 8 hours, every 8 hours the session will be destroyed and when it does the user will be logged off //$config['sess_expiration'] = 0; //default to 7200 In addition to this if a user doesn't have any activity in 30 minutes, they will log off via javascript_funcs.js $config['sess_save_path'] = APPPATH.'cache'; $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE; RE: changing session driver to database (modified) - jreklund - 06-09-2018 Create a file alongside your main index.php and use getcwd, you will get the absolute path to that directory. You should be able to work it out from there. http://php.net/manual/en/function.getcwd.php PS. APPPATH are a absolute path. RE: changing session driver to database (modified) - InsiteFX - 06-10-2018 This is how I do it makes it very easy to do. PHP Code: // ./application Works for me like a charm... |