Welcome Guest, Not a member yet? Register   Sign In
Session class only work on localhost...
#1

[eluser]toopay[/eluser]
Hi there. This is my first time to pick CI as a main framework for my project.

I have tried all the CI class, and been so helped, in work on my recent project. And so far, I found unexpected behavior of CI session class. It worked well when i test it on my local computer. But after i uploading it to my host, it doesnt work. I mean, its doesnt fully work.

I still can retrieve the basic data (ip, user agent, last activity and session id). But i can no longer adding custom session data nor retrieve it. I try to check, through the tool in the browser, and I do not found CI cookie.

I wonder, someone ever experiencing this ? And can someone tell me why this happens?

So far, i just found this explanation from CodeIgniter :
Quote:A session, as far as CodeIgniter is concerned, is simply an array containing the following information:
The user's unique Session ID (this is a statistically random string with very strong entropy, hashed with MD5 for portability, and regenerated (by default) every five minutes)
The user's IP Address
The user's User Agent data (the first 50 characters of the browser data string)
The "last activity" time stamp.

I already use a lot of functions that contain this library (which had been worked well in my local computer), and i hope someone pointed me to avoid rewrite all of that function with native php function.

Thanks
#2

[eluser]toopay[/eluser]
Just adding some information about my Host :
Linux x86_64
PHP version 5.2.13

i use the latest CI
#3

[eluser]InsiteFX[/eluser]
Did you set your cookie path in application/config/config.php ?

InsiteFX
#4

[eluser]toopay[/eluser]
Quote:Did you set your cookie path in application/config/config.php ?

InsiteFX

No, i leave the default setting in config file.

$config['cookie_domain'] = "";
$config['cookie_path'] = "/";

above setting seems only works in localhost too...

its strange, because i still can retrieve the minimum data (ip,user agent, session id, time stamp), although there is no cookie created!

i'm pretty sure this not about browser compability, because it works well in localhost for any browser i had. Is this environment compability? or...just minor bugs?
#5

[eluser]Daniel_C[/eluser]
Quote:its strange, because i still can retrieve the minimum data (ip,user agent, session id, time stamp), although there is no cookie created!

Sounds impossible to me, go to your application and execute the following code in the URL:
[removed][removed]([removed]);

If the browser shows content like ci_session=BASE64 so the cookie is correctly created.

And review too the session expiration time.
#6

[eluser]toopay[/eluser]
This is about environment compability. Cookie will not created unless i set the cookie expiration time = time()+80000 or above, in other words i can no longer setting the expiration time as i want.

Oh well, so be it.

Thx anyway Daniel C, also Insite FX.
#7

[eluser]WanWizard[/eluser]
That sounds quite unbelievable, unless the time on that server is off by almost a day...
#8

[eluser]toopay[/eluser]
Quote:That sounds quite unbelievable, unless the time on that server is off by almost a day…

Sucks. At first, I was thinking that there is something wrong with the CI session class, since all worked fine when I test on the local computer. Until I tried make a file in my host, to test, with this simple line :

Code:
setcookie("AreYouOK", "No, CI Session class reduce my sleep hours", time()+7200);

And i still can't create cookies (unless i set expiration time above '80000' or just simply '0').

My host is the real problem, and this is not the first time. At least, thats avoid me to rewrite all the function that contain session class.
#9

[eluser]WanWizard[/eluser]
Time to switch hosts... If they can't run their servers on time, what else is wrong...




Theme © iAndrew 2016 - Forum software by © MyBB