3
votes

I am using cakephp 2.0 in My Users controller i am setting a SESSION in login action using

$this->Session->write('Users',$value);

once session set it will redirect to next action named home. In login action its working I logged and checked the value, but after the redirect I read the session value by using the following in home action

$this->log($this->Session->read('Users'));

nothing displayed. But its working fine in local server.

3
Set the debug mode to '2' in app/Config/core.php and check, is there any warning it shows or something else? - Arun Jain
I have faced same problem because of extra whitespace after ?> can you set output_buffering=Off and check whether you have that extra whitespaces or not? - Loken Makwana
yes i try that.. there is no space in my files.. - AnNaMaLaI

3 Answers

2
votes

Please check the following things on your server.

  • Check your php.ini file whether session is enabled or not.
  • session.cookie.domain is set to your server or not.
  • Check for your php files having any blank lines after ?> if any please remove.

And then try.

1
votes

What I understood is: You are writing the session value into a log file. The value will not display on the screen, instead of it you can find this value in app/tmp/logs/error.log file.

This link will help you to get understand the concept.

To display the session value use pr($this->Session->read('Users'));

Kindly ask if it not worked for you.

0
votes

User cakephp debug toolkit to check the session values. By using this you'll be able to monitor many things like

  • Request History.
  • Session.
  • Sql Log.
  • Timer.
  • Log (Which you are using in your question).
  • Variable set to your view.

https://github.com/cakephp/debug_kit/ Different version of debug kit are available for different version of Cake.