Welcome Guest, Not a member yet? Register   Sign In
Code Igniter Session problem
#31

[eluser]Unknown[/eluser]
Thanks WanWizard! that information helped me.
I had also problems with IE sessions, my site was http://www.mysite.com/app and
after i changed from empty to -
Code:
$config['cookie_domain']    = "mysite.com";
$config['cookie_path']        = "/app";

IE sessions started to work just fine.
#32

[eluser]Unknown[/eluser]
I know this is an old thread, but thank you JoostV! I was loosing way too much hair over this only to find out that the culprit of my session cookie problems was the server time.

After updating the time all worked as expected. I think the thing that makes this the most frustrating is that FireFox seems to work fine while the rest of the browsers are the ones that look broken...
#33

[eluser]Unknown[/eluser]
I have the same problem, resolved by update server time is the same client time.
When you set session, CI auto set cookie with time expiration you have configured in file config.php (I set 7200 seconds). If client time faster than server time 7200 seconds or more (with my configuration), cookie will expire and CI auto destroy session, so if you get session that return NULL values.
#34

[eluser]Unknown[/eluser]
As I don't need my session to expire due time, I've just set the expiration time to "-1" on the Session.php library.


Code:
var $sess_expiration = -1; //Around line 30.
/* Location: ./system/libraries/Session.php */



With this, never expire. =)

Thank all for the sugestions.
#35

[eluser]defectivereject[/eluser]
I've got similar issues here

If i use
Code:
$config['cookie_prefix']    = "";
$config['cookie_domain']    = "localhost";
$config['cookie_path']        = BASE_URI;
Then Safari works fine, but Firefox, Chrome and Chromium stop working (Auto logs out as soon as logs in)

if i use
Code:
$config['cookie_prefix']    = "";
$config['cookie_domain']    = ($_SERVER['SERVER_NAME'] == 'localhost' ? '' : preg_replace('/^www\./', '', $_SERVER['SERVER_NAME']));
$config['cookie_path']        = BASE_URI;
Then Safari stops working and Firefox, Chrome and Chromium start working....

If i use
Code:
$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";
Nothing works.

Any Help??

Running CI 2.0 locally on a MAMP server and a WAMP server its the same issue.
Issue doesn't seem to be there in 1.7.2
#36

[eluser]WanWizard[/eluser]
According to the cookie RFC, 'localhost' is an invalid cookie domain, more and more browsers refuse the cookie if you use that. For the same reason, an empty domain is rejected.

Setup a dummy hostname for your local machine in your hosts file (like 'mypc.domain.local'), and use that instead of localhost.
#37

[eluser]defectivereject[/eluser]
Yeah i saw that earlier in the thread, but one of the machines runs on a server broadcasting its ip address not localhost
i.e.
172.10.1.10
#38

[eluser]WanWizard[/eluser]
If that server runs without virtual hosts, then your website is accessable via the IP address. So your cookie domain can be the IP, according to the RFC that is valid.
#39

[eluser]Unknown[/eluser]
Hello All

I was also facing same problem.
Session was working fine on Firefox but not on IE.
So I just made some changes in config.php

Replaced this

$config['sess_expiration'] = 7200;

With

$config['sess_expiration'] = 43200;

and its working fine in All Browsers.
#40

[eluser]Anupam82[/eluser]
[quote author="Jim Higgins" date="1217644738"]This thread is old, but I spent the day trying to solve this so I thought I would share what worked for me. Here was my situation...

On my dev environment (XAMPP), all sessions worked fine in FF and IE. As soon as I moved to production, IE7 would not delete a session key I was using. The most common solution I found in these threads was to make sure your server time/date was correct. Mine was correct and it was still not working in IE.

So, I then moved over to using the Native Sessions library from the Wiki (http://codeigniter.com/wiki/Native_session/). This did the trick for the most part with a couple of different additions. Right before I reset the session data in my application code, I needed to unset any existing key with that same value...

$this->session->unset_userdata(array('my_key' => ''));

Lastly, when I moved to the Native Sessions library, I had to change a call in my logout function from sess_destroy() to destroy(). This seemed to be the only inconsistency between using Native Sessions and CodeIgniter's session (for me at least).

The Native Sessions library is one file that just gets dropped into application/libraries

Aside form the destroy(), you load it and call everything the same as the CI Session class.[/quote]

Thanks for sharing your experience and the Native Session link, it helped me a lot Smile




Theme © iAndrew 2016 - Forum software by © MyBB