EllisLab text mark
Advanced Search
     
Session class only work on localhost…
Posted: 21 December 2010 09:31 PM
Avatar
Joined: 2010-12-20
1591 posts

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 :

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

 Signature 

“In Code We Trust.”


CI Library : Gas ORM | Proxy

 
Posted: 21 December 2010 09:49 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2010-12-20
1591 posts

Just adding some information about my Host :
Linux x86_64
PHP version 5.2.13

i use the latest CI

 Signature 

“In Code We Trust.”


CI Library : Gas ORM | Proxy

 
Posted: 22 December 2010 12:52 AM   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6706 posts

Did you set your cookie path in application/config/config.php ?

InsiteFX

 Signature 

Certified State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

Skype: insitfx

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 22 December 2010 03:54 PM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2010-12-20
1591 posts

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?

 Signature 

“In Code We Trust.”


CI Library : Gas ORM | Proxy

 
Posted: 22 December 2010 05:22 PM   [ # 4 ]   [ Rating: 0 ]
Joined: 2010-12-22
8 posts

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.

 
Posted: 22 December 2010 05:55 PM   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2010-12-20
1591 posts

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.

 Signature 

“In Code We Trust.”


CI Library : Gas ORM | Proxy

 
Posted: 23 December 2010 06:05 AM   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4489 posts

That sounds quite unbelievable, unless the time on that server is off by almost a day…

 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM <= LOOKING FOR A NEW MAINTAINER!

 
Posted: 23 December 2010 12:24 PM   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2010-12-20
1591 posts

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 :

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.

 Signature 

“In Code We Trust.”


CI Library : Gas ORM | Proxy

 
Posted: 23 December 2010 12:31 PM   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2008-11-04
4489 posts

Time to switch hosts… If they can’t run their servers on time, what else is wrong…

 Signature 

Me: WanWizard.eu | My company: Exite | Datamapper: DataMapper ORM <= LOOKING FOR A NEW MAINTAINER!