Friday, April 6, 2012

php redirect losing sessions on Chrome/IE issue resolved

My new CodeIgniter app was working beautifully locally - everything's just fine. But when I uploaded to the demo location online - I found I can't login !! After debugging it is discovered - after checking the user credentials and setting the sessions when I was redirecting to the dashboard the user- session was getting lost !
Started with googling for a while and following is the link I got people were suggesting couple of fixes :

Unfortunately, this din solve my issue. I was still getting lost sessions. And finally, [I don remember where I saw someone was suggesting to check the server time] I checked my server time and yes, it was certainly not right - around 5 hours late from the time as it was supposed to be. Fixed the time with the following command [as it was a linux box] :
date +%T -s "10:13:13"
Then, tried login again and bingo - it is working cool.

Reference:
  1. Linux commands to set dates and time

4 comments:

  1. hi what server are you referring to change the time?

    I also encounter this problem using CI session in CHROME

    tHANKS

    ReplyDelete
  2. Setting the right time worked for me too.
    Thank you!

    ReplyDelete