php - session is not working in new server
562
I moved my code-igniter project to new server but session is not working across other page but in same page controller function is like
public function login()
{
$typo = "teacher";
$co=array('ededge_typo' => $typo);
$this->session->set_userdata($co);
$this->load->view('header');
}
in view
<?php var_dump($this->session->userdata('ededge_typo'))); ?>
but i get output Null
when i tried in localhost i get
C:\wamp\www\cii\application\views\header.php:1:string 'Teacher' (length=7)
please help me to
my configuration in codeigniter is
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['time_reference'] = 'gmt';
Answer
Solution:
Have you tried to print session by print_r($_SESSION) on your view page. Print it, if your session is set it will show you.
Answer
Solution:
Use database session
https://codeigniter.com/userguide3/libraries/sessions.html
Thanks.
Answer
Solution:
From codeigniter documentation:
If you dont want to change that folder manually every time when you change server, you could try something like
The fcpath one should be xxx/my_app/tmp and basepath should be xxx/my_app/application/tmp
Both folders should be writeable.