Welcome Guest, Not a member yet? Register   Sign In
CI3 Session problem on prod environment
#1

Hello there, 

It's a second day as I'm looking for a solution, even the topics with the same title as my problem in this forum do not help to solve my issue... 

I developed a page locally on my system. Session library is auto-loaded, I'm using sess_driver = files, sess_save_path is set, when logging in to the page - everything works fine, new session file is generated etc. I uploaded all the files to production environment and when I'm trying to login - it fails because session data is empty. It seems like session is destroyed for every page load. I checked the sessions folder - new files are generating, and some of them actually has all the required user data, but when redirect() to user dashboard occurs - new session file with no data is generated. 

Since session files are generated I assume there is everything fine with configs, moreover, everything works locally. Redirection in Login controller looks like this:
PHP Code:
$sessData = array(
 
 'user'    => $userObject,
 
 'website' => 'my_site_url'
);
$this->session->set_userdata($sessData);
redirect("/admin/dashboard"); 

And this code in admin dashboard prints no user data (only "Array ( [__ci_last_regenerate] => 1526963570 )"):

PHP Code:
$sessionData $this->session->userdata();
print_r($sessionData);
die(); 


Do you have any ideas what's missing? Can it be that CI3 requires some specific PHP setting so it doesn't keep sessions live?
My local machine - Windows 10 based server with PHP 5.5.12,  production environment - Linux based with PHP 7.1.16. I also tried to change session configs and save data to DB and the result was exactly the same - new records were added to a table, but userdata() newer returned my user data on production environment, even though it was working well locally.
Reply


Messages In This Thread
CI3 Session problem on prod environment - by pJenkiss - 05-21-2018, 10:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB