3

I just migrated my app to appfog. I store the session info in the database. But the session is lost after page refresh or on redirect. I am using cakephp 2.2.3, the app works fine on local machine and namecheap servers. On Appfog, I deleted all stored sessions in session table in database. So when I login a new records are created. When session info is available onlogin, but is lost on refresh or on redirect.

I appreciate any help.

Leah Collins
  • 637
  • 2
  • 9
  • 21
  • check CAKEPHP cookie after successful authentication and after refresh or redirect which lead to loose authentication. has cookie same value or not? – Vadim Jun 28 '13 at 16:31
  • Check your code for whitespace, it can be the reason – Loken Makwana Jul 19 '13 at 05:57
  • I have no idea if this applies to your situation, but CakePHP will lose session if the session's time doesn't match the time on the server on which CakePHP is hosted. So if you're using a different server for storing your sessions, make sure its time matches the server that's hosting your site. – Kai Aug 30 '13 at 23:44
  • show me your code, than will give you right answer. – Vinod Patidar Oct 19 '13 at 09:53
  • did you check your actions you might written destroy session some where. and your session it might be not saved on db and if you think it is before refresh could you make sure your saving your session on db and when you refresh what cause that your session deleted from DB. – Fury Nov 28 '13 at 11:42
  • write your session in your appController in **beforeRender()** should work. – Fury Jan 30 '14 at 14:18

1 Answers1

3

in your core.php you have to set your session.start to true

Configure::write('Session.start', true);
MOHA
  • 122
  • 1
  • 10