• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
session is being expired autometically

#1
Hello Guys,

One of my codeigniter Application is not working properly on the server but it's working on my localhost and also working on another VPS server. But not working on my cPanel hosting.

I use wordpress and codeigniter mostly and this session issue is causing only with codeigniter not with wordpress.

I'm using autoload to load session and all others.

Let me know if you guys need any other information

Thanks in advanced.
Reply

#2
You should show your session and cookie config. Have you done an isolated session test?
Reply

#3
example ur: http://www.domainname.com/temp/welcome/index

when I open it then refresh it.. if session is set then it will show Session working message. then remove the index from url and write about.. it will still show the session working message.

but when I'm clicking on the about hyperlink bellow the message "session working" then session is gone.

here below is the controller code:

PHP Code:
class Welcome extends CI_Controller {

    public function 
index()
    {
     
   if(isset($_SESSION['test_session'])){
     
       echo "session working";
     
   }else{
     
       $this->session->set_userdata('test_session''session set');
     
   }
     
   
        echo 
'<br><a href="'.base_url().'welcome/about'.'">about </a>';
    }
    
    public function 
about()
    {
     
   if(isset($_SESSION['test_session'])){
     
       echo "session working";
     
   }else{
     
       redirect('welcome/index''refresh');
     
   }
    }


I have also attached the cofig folder please check and let me know.. How can I solve the issue.


Attached Files
.zip   config.zip (Size: 21.94 KB / Downloads: 24)
Reply

#4
Have you set your session save path.
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply

#5
Does your host server use the same domain name as your web application?
Reply

#6
You also need to tell us what type of sessions you are using, file / database / etc;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#7
Hi,

Thank you so much for replies guys..

$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['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']        = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']     = FALSE;

here is the session config and cokie config

Thanks!!
Reply

#8
(09-26-2017, 06:46 PM)shynquynh Wrote: Does your host server use the same domain name as your web application?

yes I'm using the same domain name.
Reply

#9
(09-27-2017, 06:38 AM)tysonchamp Wrote: Hi,

Thank you so much for replies guys..

$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['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']        = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']     = FALSE;

here is the session config and cokie config

Thanks!!

Read the in-file documentation above these settings in config.php.
Reply

#10
(09-27-2017, 06:38 AM)tysonchamp Wrote: Hi,

Thank you so much for replies guys..

$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['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']        = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']     = FALSE;

here is the session config and cokie config

Thanks!!


You need to set the save path to some thing like this example



PHP Code:
 $config['sess_save_path'] = APPPATH  'cache/sessions/'

Folder permission 0700
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.