Can’t Log In After CodeIgniter 3.1.2 Upgrade?
If you’re using Community Auth and upgrade CodeIgniter to version 3.1.2, you will no longer be able to log in as any user. If you can log in, you won’t be able to stay logged in. The reason for this is that there were changes in CodeIgniter’s Session library, and because Community Auth extends the Session library with MY_Session.php, you’d need to upgrade the extension, as well as make some simple changes to your database.
The Community Auth repository had commits back in November of 2016 to fix this issue, but people are still running into this problem and not realizing what needs to be done.
1) Increase the size of the id field in the ci_sessions table from 40 to 128.
ALTER TABLE `ci_sessions` CHANGE `id` `id` VARCHAR( 128 ) NOT NULL;
2) Increase the size of the id field in the auth_sessions table from 40 to 128.
ALTER TABLE `auth_sessions` CHANGE `id` `id` VARCHAR( 128 ) NOT NULL;
3) Look at/near lines 101 of MY_Session.php for the following code:
ini_set('session.hash_function', 1); ini_set('session.hash_bits_per_character', 4);
Replace with:
if( version_compare( CI_VERSION, '3.1.2', '<' ) ) { ini_set('session.hash_function', 1); ini_set('session.hash_bits_per_character', 4); } else { $this->_configure_sid_length(); }
That should get you back in action.