I use the CodeIgniter session function and I run this code:
$session_id = $this->session->userdata('session_id'); echo "My Session ID is $session_id";
And it changes every time the page loads. Does this mean that sessions are not being saved properly? Is there any way to debug this and find out why? Or am I not using this library correctly?
I get no errors when turning on error reporting, and I use the CI autoload ability to load the session library:
$autoload['libraries'] = array('session');
Any advice will help thanks!
Example code output above:
My Session ID: 7c92bac53d2654df6e87eb4e4cb25467
.. reboot ..
My session id is c6dd14aed2499760f788a1364dcab030
UPDATE: Session configurations inside config.php look like this:
$config['sess_cookie_name'] = 'ci_session'; $config['sess_expiration'] = 7200; $config['sess_expire_on_close'] = FALSE; $config['sess_encrypt_cookie'] = FALSE; $config['sess_use_database'] = FALSE; $config['sess_table_name'] = 'ci_sessions'; $config['sess_match_ip'] = FALSE; $config['sess_match_useragent'] = TRUE; $config['sess_time_to_update'] = 300;
So, I found that
session_start(); $_SESSION['myvar']='var';
also doesnโt store anything, something seems to be wrong in the session store on my Linux server.
My session save path has apache: apache 775 permissions. Perhaps this needs to be ported to serverfault?
source share