![]() |
PHP - Session problem in codeigniter framework - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: PHP - Session problem in codeigniter framework (/showthread.php?tid=69131) |
PHP - Session problem in codeigniter framework - Khadeer - 10-12-2017 Hi, I have a website which has started causing a strange problem from last few days. It has login protected area. On live server, when I try to login, it fails to create session. and redirects me to home page again. While the same login work on local machine perfectly. Actually what I think, problem is this that session is created but it gets lost when I redirect user to other page. It was working fine few days ago but suddenly it has started causing this frustrating problem. I am using codeigniter framework. Can any one help please ? Thanks RE: PHP - Session problem in codeigniter framework - dave friend - 10-12-2017 How do you load the "session" library? What are the session config settings you are using? RE: PHP - Session problem in codeigniter framework - Khadeer - 10-12-2017 (10-12-2017, 10:18 AM)dave friend Wrote: How do you load the "session" library? Im Loading Session Library in autoload file. $autoload['libraries'] = array('database', 'session', 'form_validation'); Session Config Settings: $config['sess_driver'] = 'files'; $config['sess_cookie_name'] = 'pop_session'; $config['sess_expiration'] = 7200; $config['sess_save_path'] = NULL; $config['sess_match_ip'] = FALSE; $config['sess_time_to_update'] = 300; $config['sess_regenerate_destroy'] = FALSE; RE: PHP - Session problem in codeigniter framework - InsiteFX - 10-13-2017 Mostly it is your session_save_path, the documentation shows how to set it up for files. RE: PHP - Session problem in codeigniter framework - Khadeer - 10-13-2017 (10-13-2017, 03:08 AM)InsiteFX Wrote: Mostly it is your session_save_path, the documentation shows how Still No Use im using codeigniter 3.0 and in my server PHP Version 7.1.7 RE: PHP - Session problem in codeigniter framework - bjs17 - 10-13-2017 create a session_save_path and assign it to $config['sess_save_path'] = 'your session's folder path'; Make sure your session's folder is writable. RE: PHP - Session problem in codeigniter framework - bjs17 - 10-13-2017 (10-13-2017, 06:23 AM)Khadeer Wrote:(10-13-2017, 03:08 AM)InsiteFX Wrote: Mostly it is your session_save_path, the documentation shows how create a directory and assigned it to $config['sess_save_path'] = 'your directory path'; Make sure the directory is writable RE: PHP - Session problem in codeigniter framework - PaulD - 10-13-2017 Have you followed all these details: https://www.codeigniter.com/user_guide/libraries/sessions.html#files-driver The path needs to be an absolute path. The permissions need to be high enough for access, 0700 is recommended, but there is also a note in the instructions about www-data access. Quote:It was working fine few days ago but suddenly it has started causing this frustrating problem. I would write a test page that did not redirect on session fail. Then at least you can use the profiler to look at what is in the session variables. Compare it to the page where you say the session is set. There might also be a problem in the code you are using to test the session status. You originally quoted PHP Code: $config['sess_save_path'] = NULL; Also it is worth upgrading your system files to 3.1.6, there have been many bug fixes and improvements since 3.0, you are about 12 versions behind, including fixes for sessions, although I do not really think your issue is caused by any of these, it might be. If you are using an auth library of any description, perhaps there are some settings you have not updated in the auth package. Hope something here helps, Paul. RE: PHP - Session problem in codeigniter framework - Narf - 10-13-2017 (10-13-2017, 06:23 AM)Khadeer Wrote: Still No Use im using codeigniter 3.0 and in my server PHP Version 7.1.7 PHP 7.1.0 was released on December 1st, 2016. CI 3.0.6 (the last 3.0 one) was released on March 21st, 2016. See the problem here? RE: PHP - Session problem in codeigniter framework - Khadeer - 10-14-2017 Thanks Guys it is working now. I have upgraded my CI to Latest Version. Thanks a lot for your replies. |