Cakephp Sessions not working properly

2,345 views
Skip to first unread message

Shoba Kumar

unread,
Jan 1, 2013, 4:16:54 AM1/1/13
to appfog...@googlegroups.com
Hi,

I just migrated my app from phpfog. Now I have problem with cakephp session. I am using cakephp 2.2.4. I have simple login screen. On login, I write user's info in session variable. And read it when needed. It works fine on my local server(xampplite) and I also tried on namecheap servers it works fine. But on appfog, It writes session variable and reads it fine on logins as intended, but if I refresh the page or try another page the session info is no longer available. I tried setting the session timeout to 3 days, still same problem. Also tried to switch to database session (in core session configuration) still same problem.

Problem is the session info is not available on page refresh or on redirect.

I appreciate any help.

Shoba Kumar

unread,
Jan 1, 2013, 6:04:15 AM1/1/13
to appfog...@googlegroups.com
I understand Disk storage is not persistent. So I switched to session storage to database in the core.php and setup the database as required.

Configure::write('Session', array(
    'defaults' => 'database',
        'handler' => array(
        'model' => 'cake_sessions'
        )
));

Issue still exists. I appreciate any help.

Thanks.

ihti

unread,
Jan 6, 2013, 7:12:17 PM1/6/13
to appfog...@googlegroups.com
I had exactly same problem with CakePHP and sessions, three month ago. It happens randomly, they never fixed it and support have no idea what's problem.

And for sure I can tell that problem is at AppFog not CakePHP.

Pasquale Vazzana

unread,
Feb 5, 2013, 3:35:34 AM2/5/13
to appfog...@googlegroups.com
Same problem here, I switched to database as well but the problem still exists. I'm using Laravel as PHP framework but it seems that it's not framework related. The weird thing is that yesterday (after app creation) everything worked...

Pasquale Vazzana

unread,
Feb 5, 2013, 3:38:29 AM2/5/13
to appfog...@googlegroups.com
After further investigation I noticed that the session is just recreated, in my database I see as many session as many connections my browser does. Everytime I connect the website it creates a new session, as for every page I visit. I'm using chrome and the cookie stores the session id as expected.

rich

unread,
Feb 5, 2013, 4:03:59 PM2/5/13
to appfog...@googlegroups.com
is Session.checkAgent turned on?  If so try disabling it and see if that helps because it sounds like your sessions are being invalidated on each https request.

Regards,
Rich

Pasquale Vazzana

unread,
Feb 6, 2013, 1:40:35 AM2/6/13
to appfog...@googlegroups.com
Session.checkAgent is a CakePHP setting, I'm using Laravel that doesn't use this setting.


2013/2/5 rich <ri...@appfog.com>

--
You received this message because you are subscribed to the Google Groups "AppFog Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appfog-users...@googlegroups.com.
To post to this group, send email to appfog...@googlegroups.com.
Visit this group at http://groups.google.com/group/appfog-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

rich

unread,
Feb 6, 2013, 11:53:24 AM2/6/13
to appfog...@googlegroups.com
Are you using cookie sessions?  And do you have any code to share that can help debug?

-Rich

Pasquale Vazzana

unread,
Feb 6, 2013, 1:30:09 PM2/6/13
to appfog...@googlegroups.com
For what regards the code I guess it doesn't matter, I tried also a fresh installation of Laravel. Unfortunately I cannot make further tests, I deleted the app and gave up. However the strange thing is that the previous day everything was working as expected.


2013/2/6 rich <ri...@appfog.com>

Arstan Jusupov

unread,
Feb 15, 2013, 2:25:46 AM2/15/13
to appfog...@googlegroups.com
Hi Shoba,
I had similar case with CodeIgniter app... I found solution as to increase session expiration to more than 24hours. I can only assume that the reason you have session problems is that the server timezone is different from yours and thats a problem.

I hope it helps for you. It took me few hours to understand this.

Justin Vincent

unread,
Apr 11, 2013, 6:58:15 PM4/11/13
to appfog...@googlegroups.com
I think the answer to this is to use session_name before session_set_cookie_params. For example...

session_name('MySession');
session_set_cookie_params( 3600*24, '/', $_SERVER['HTTP_HOST'], is_https() );
session_cache_expire(60*24); // cache expire 60 mins

On Tuesday, January 1, 2013 1:16:54 AM UTC-8, Shoba Kumar wrote:

AppFogHosting

unread,
Jun 28, 2013, 3:16:06 AM6/28/13
to appfog...@googlegroups.com
how to configure CakePHP ? please let me know or give me the link to do
Reply all
Reply to author
Forward
0 new messages