• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Session doesn't work after update from 2.2.1 to 3

#1
Hello, I am updating from CI2.2 to CI 3.0 using the tutorial. I have done the following modifications in the config.php 
$config['sess_cookie_name'] = 'ci_sessions';
$config['sess_expiration'] = 86400; //24 hours
$config['sess_expire_on_close'] = TRUE;
$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'] = 86400; //24 hours
$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_sessions';

Earlier there was no ci_sessions table so I  have created one in the database.

In  autoload.php I have this line 
$autoload['libraries'] = array('database','session');

In my controller I am using   $this->load->library('session');

But I am getting error Unable to locate the specified class: Session.php 
But incase I move Session.php from Session folder to libraries I dont get any error but login page doesn't work.

I have commented session.start() function in the Session.php class as the application gave my error Severity: Warning


Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time

Filename: libraries/Session.php

Line Number: 322
 
Please help me. I am new in the company without any mentor to help. 
Reply

#2
Try to uncomment
$config['sess_use_database'] = FALSE;
Reply

#3
(01-25-2017, 01:59 PM)muuucho Wrote: Try to uncomment
   $config['sess_use_database'] = FALSE;
I did that still the same error.
Reply

#4
Have you read and followed:
https://www.codeigniter.com/userguide3/i...e_300.html

Have you tried:
http://lmgtfy.com/?q=%22Unable+to+locate...ion.php%22
Reply

#5
(01-25-2017, 02:18 PM)Diederik Wrote: Have you read and followed:
https://www.codeigniter.com/userguide3/i...e_300.html

Have you tried:
http://lmgtfy.com/?q=%22Unable+to+locate...ion.php%22

Yes, Sir this is how the config.php looks now 
$config['sess_cookie_name'] = 'ci_sessions';
$config['sess_expiration'] = 86400; //24 hours
//$config['sess_expire_on_close'] = TRUE;
//$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = FALSE;
$config['sess_match_ip'] = FALSE;
//$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 86400; //24 hours
$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_sessions';

Still I am getting the same error.
Reply

#6
1) Not using a database, your config says that session data will be stored in the "ci_sessions" folder. I trust that folder exists and is writeable?

2) It is a really bad idea to mess with files inside system, for instance moving a file around or changing its functionality.
Reply

#7
(01-25-2017, 12:18 PM)raminderrandhawa Wrote: But I am getting error Unable to locate the specified class: Session.php 
But incase I move Session.php from Session folder to libraries I dont get any error but login page doesn't work.

You're not supposed to do that.
Also, if by "move" you mean "overwrite another Session.php file that was already there", then you haven't followed the upgrade instructions.

(01-25-2017, 12:18 PM)raminderrandhawa Wrote: I have commented session.start() function in the Session.php class as the application gave my error Severity: Warning


Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time

Don't comment out just to hide errors. You're breaking stuff that way.
The error message is pretty clear - you already have a session started elsewhere.

(01-25-2017, 02:31 PM)raminderrandhawa Wrote:
(01-25-2017, 02:18 PM)Diederik Wrote: Have you read and followed:
https://www.codeigniter.com/userguide3/i...e_300.html

Have you tried:
http://lmgtfy.com/?q=%22Unable+to+locate...ion.php%22

Yes, Sir this is how the config.php looks now 
$config['sess_cookie_name'] = 'ci_sessions';
$config['sess_expiration'] = 86400; //24 hours
//$config['sess_expire_on_close'] = TRUE;
//$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = FALSE;
$config['sess_match_ip'] = FALSE;
//$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 86400; //24 hours
$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_sessions';

Still I am getting the same error.

Did you read the note marked as Important in Step 1? See my reply to the first quote above.

Also, you're still keeping stuff from CI2 that you're not supposed to. Start clean - use the CI3 config.php and only modify the options it has.

(01-25-2017, 02:55 PM)ciadmin Wrote: 1) Not using a database, your config says that session data will be stored in the "ci_sessions" folder. I trust that folder exists and is writeable?

He's using the database driver.
Reply

#8
(01-25-2017, 02:55 PM)ciadmin Wrote: 1) Not using a database, your config says that session data will be stored in the "ci_sessions" folder. I trust that folder exists and is writeable?

2) It is a really bad idea to mess with files inside system, for instance moving a file around or changing its functionality.

Hello Sir, thanks for the guidance .

But there is no ci_sessions folder I asked regarding that from the developer who worked on this project .
That's why I have created ci_sessions table in the database . When i check this table there is value of id,ip_address, timestamp,data created when I login but along with that I get error Unable to locate the specified class: Session.php 
I have kept Session.php inside Session folder and will not play around that file.

Further guidance would be really appreciated.
Reply

#9
(01-25-2017, 03:21 PM)Narf Wrote:
(01-25-2017, 12:18 PM)raminderrandhawa Wrote: But I am getting error Unable to locate the specified class: Session.php 
But incase I move Session.php from Session folder to libraries I dont get any error but login page doesn't work.

You're not supposed to do that.
Also, if by "move" you mean "overwrite another Session.php file that was already there", then you haven't followed the upgrade instructions.

(01-25-2017, 12:18 PM)raminderrandhawa Wrote: I have commented session.start() function in the Session.php class as the application gave my error Severity: Warning


Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time

Don't comment out just to hide errors. You're breaking stuff that way.
The error message is pretty clear - you already have a session started elsewhere.

(01-25-2017, 02:31 PM)raminderrandhawa Wrote:
(01-25-2017, 02:18 PM)Diederik Wrote: Have you read and followed:
https://www.codeigniter.com/userguide3/i...e_300.html

Have you tried:
http://lmgtfy.com/?q=%22Unable+to+locate...ion.php%22

Yes, Sir this is how the config.php looks now 
$config['sess_cookie_name'] = 'ci_sessions';
$config['sess_expiration'] = 86400; //24 hours
//$config['sess_expire_on_close'] = TRUE;
//$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = FALSE;
$config['sess_match_ip'] = FALSE;
//$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 86400; //24 hours
$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_sessions';

Still I am getting the same error.

Did you read the note marked as Important in Step 1? See my reply to the first quote above.

Also, you're still keeping stuff from CI2 that you're not supposed to. Start clean - use the CI3 config.php and only modify the options it has.

(01-25-2017, 02:55 PM)ciadmin Wrote: 1) Not using a database, your config says that session data will be stored in the "ci_sessions" folder. I trust that folder exists and is writeable?

He's using the database driver.

Hello Sir, In the first step  I deleted the folder system and copied the system folder from codeigniter 3.1.3.
Is it supposed to be done this way or some other way. I might be doing something incorrectlt . Please correct me . Thanks for your help.
Reply

#10
Any help related to this problem will be really appreciated.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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