• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upgrade 2.0.2 to 3.1.10 session problem on local mamp

#1
I'm updating my Codeigniter. I've deleted de system folder and replaced it with the new one. I've followed the Upgrading from 2.2.x to 3.0.x instructions. These are my new settings for the session:

I use autoload for the Session.

$config['sess_driver'] = 'files';

$config['sess_cookie_name'] = 'ci_session';

$config['sess_expiration'] = 0;

$config['sess_save_path'] = APPPATH.'/sessions';

$config['sess_match_ip'] = FALSE;

$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE;

I use: 
      $newdata = array(

        'username'  => $member->email,

        'owner_id'  => $member->member_id,

        'logged_in' => TRUE

      );


      $CI->session->set_userdata($newdata);

 can print username, owner_id after the set_userdata, but when I redirect to the default page in my admin, I get $_SESSION empty

(except for the __ci_last_regenerate )

The folder is "OK"(I can see the new session).
I'm using MAMP PRO 5.3 with on port 8890 for ssl. I've tried database driver with same results.

I've tried PHP 7.1.26, 7.0.33, 5.6, 7.3.3

Thanks
Reply

#2
What are your cookie $config settings?

I'm asking about this set of config items.
PHP Code:
$config['cookie_prefix'
$config['cookie_domain'
$config['cookie_path']
$config['cookie_secure']
$config['cookie_httponly'

They must also be set correctly.

You must have permissions and ownership set appropriately for APPPATH.'/sessions'; too.
Reply

#3
(04-12-2019, 04:52 PM)dave friend Wrote: What are your cookie $config settings?

I'm asking about this set of config items.
PHP Code:
$config['cookie_prefix'
$config['cookie_domain'
$config['cookie_path']
$config['cookie_secure']
$config['cookie_httponly'

They must also be set correctly.

You must have permissions and ownership set appropriately for APPPATH.'/sessions'; too.


Here's my settings:

$config['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']        = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']     = FALSE;

I've tried with domain and a lot more different configuration. 
Thanks
Reply

#4
(04-13-2019, 06:07 AM)defos931 Wrote: Here's my settings:

$config['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']        = '/';
$config['cookie_secure']    = FALSE;
$config['cookie_httponly']     = FALSE;

I've tried with domain and a lot more different configuration. 
Thanks

Did you try this for the domain?

PHP Code:
$config['cookie_domain']    ".example.com"

Note the period (.) before the domain.

While it should not make a difference I suggest using the following config item until you get everything else working.

PHP Code:
$config['sess_regenerate_destroy'] = FALSE
Reply

#5
Update:

the config is good because I can trick something to get the session working. But, when I logged a new session is created, then I redirect and validate in the redirectController if I'm logged, but then the session_id change.

I've a library Authentification that I autoload. I do in the constructor : $this->CI =& get_instance();

It's like when I redirect, I get a new session and the weird thing is when I redirect for a second time(because where're not logged in) the session is ok.
Thanks for any help
Reply

#6
The session cannot be said to be working when you set session data and then, after a redirect, cannot find that saved data in $_SESSION.

Your problem might be the configuration or it might be the Authentication library implementation. What you describe has been traced to configuration problems time and time again.

Maybe if you examine cookie creation and which cookies are being transferred to/from the browser/server it will help you confirm that the cookie config is good. It may not be the problem. In which case it is probably custom code implementation.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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