• Register
0 votes

Problem :

I am in a process of upgrading my codeigniter from the 1.7.2 to 2.0.1.

Everything seems to have gone as expected except I get below error:

“In order to use the Session class you are required to set an encryption key in your config file.”

What is a change in 2.0.0/2.0.1 that has caused above error?

What change should I do to fix the above error.

Will making the said change break anything for me?

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes


The reason they are asking you for an encryption key is for security (obviously)

Note: Even if you are not using the encrypted sessions, still you must set the encryption key in the config file which should be used to aid in preventing your session data manipulation. -

This modification will not break your code. But be very careful when updating it from 1.7.2 to 2.0.1. I suggest you must backup your code before updating it.

They have added a security improvement with a 2.0.0 version of the CI. I don't know why they did not talk about it in their upgrade guide though.


If you use a Encryption class or a Session class then you MUST set the encryption key. Please see a user guide for info on it.

$config['encryption_key'] = '02527-269-2503946-70386-34730519'; 
9 7 4
38,600 points

Related questions

0 votes
1 answer 147 views
0 votes
1 answer 16 views
Problem: the filetype you are attempting to upload is not allowed.
asked Feb 24 Ethan ross 2.3k points
0 votes
1 answer 21 views
Problem: unable to access an error message corresponding to your field name.
asked Feb 13 Shovo210 13.2k points
0 votes
1 answer 2 views
Problem: I am stuck with (get_where with order by in codeigniter.). Someone, please help me.
asked Mar 30 zayed1 24.7k points
0 votes
1 answer 19 views
1 vote
1 answer 2 views
Problem: Please help me. How can I solve it? backup your file encryption key windows 7 message
asked 4 days ago MUHAMMAD MUNEEB 80k points
0 votes
1 answer 127 views
Problem When I try to upload an image using codeigniter, regardless of what I do, I end up with: You did not select a file to upload error. Please help fixing this error
asked Nov 3, 2020 hashq 1.1k points
0 votes
1 answer 169 views
Problem : I am new to MySQL driver. I am trying to connect to the database server using MySQL driver but I always face the below error. A Database Error Occurred Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 232 Please ... I am trying to fix above error from past couple of days but unable to find any solution on it. How can I fix it?
asked Feb 25, 2020 mphil 2.3k points
0 votes
1 answer 24 views
Problem: Im stuck with this error and not able to cancel it, i need to solve this error ASAP> wrong $cfg->dbtype: you need to change it in your config.php file, from 'mysql' to 'mariadb'.
asked Feb 26 Azlan2020 2.3k points
0 votes
1 answer 7 views
Problem: I get an error at insert pivot table code. The page you requested was not found. in codeigniter I'm having a problem with CodeIgniter. I've checked every possible solution on the internet and seems like nothing helps in my case. I'm not a big pro
asked Mar 20 ummesalma 22.9k points