I am setting the session when a user logs in using:
$session['fname'] = $user->firstName;
After login, if I print_r() the session in the default site controller i can see all the values. But when i redirect to the next page I lose the session.
This problem occurs only on the live environment. On the test server everything is working fine.
I have also attached some images of my php session config on the live and test environments.
Thank you, in advance, for your help.
Thank you for your reply. I tried your suggestions but it still wont work.
I think the /var/php_sessions directory is writable because the session is being set on the first page. It’s only when I redirect the page that the session is empty.
Thank you in advance for your help.
June 28, 2010, 7:39am
Hmm. Do you maybe logout() a user somewhere? Because then the session will be cleared. Besides that, i would experiment with $_SESSION a little to find out, wether it’s a problem with your PHP installation or your Yii session configuration.
Thank you Mike.
I’ll try that out. Will let you know what happens.
August 16, 2011, 8:36pm
it also occures on me. Who knows how can we solve it?
I’m sorry I had not added my solution to this problem
But yes! It’s solved. The problem was with the session_save_path of my host server. They were storing it in the home directory of my account.
I suggest you check out the PHP settings on your server. You can use this script
<?php phpinfo(); ?>
Look for the
session_save_path variable and check the path. you can also set this using the session_save_path() function.
Hope this helps