Next, scroll down to line 220 and look at the Encryption Key. Depending on the type of project you’re working on, you might not need this, but let’s go ahead and set it for fun.

One of the (many) things I love about CodeIgniter, is that they’re code is well documented. Straight from their documentation:

To take maximum advantage of the encryption algorithm, your key should be 32 characters in length (128 bits). The key should be as random a string as you can concoct, with numbers and uppercase and lowercase letters. Your key should not be a simple text string. In order to be cryptographically secure it needs to be as random as possible.

To keep my keys as random as possible, I’ll typically use a generator. A quick google search returned randomkeygen.com. There’s even a section there for CodeIgniter Encryption Keys. Perfect!

Pick one of the 3 options there and copy and paste it into your config file.

That was easy.

Now, let’s look at the database.php file. This is pretty straight forward too. Scroll down to line 40.

The first thing you have to do is set your database host. If you’re developing locally, it will stay “localhost.” However, if you’re building the site online, this might look different. You’ll have to check GoDaddy or MediaTemple or HostGator or whoever’s documentation.

On line 41 and 42, you need to set your username and password. If you’re running MAMP, it will actually tell you all this information on the start screen.

On line 43, you’ll set the name of the database. If you’re following along, in Part 3, we named our databae awesome_ci.

When you’re done, your file should look like this:

I told you it wasn’t anything crazy! Our config file is now up and running.