Once successful installation of CodeIgniter, you need to make a few modifications on CodeIgniter config file so that CodeIgniter is properly configured and can access your database.
Configuring Base URL:
To set Base URL open “config.php”, this is located in “/application/config/” relative to your root directory of CodeIgniter, for us, that would be “C:wampwwwCodeIgniterapplicationconfig”
On line 17, you will notice:
$config[‘base_url’] = “”;
Change blank URL to the URL of your CodeIgniter install server URL, so it should be:
$config[‘base_url’] = “http://localhost/CodeIgniter/”;
See image below:
Configuring Encryption Key:
In the same file, on line 220 you will notice it. Here I configured it as $config[‘encryption_key’] = ‘example‘ instead of $config[‘encryption_key’] = ”; See image below.
Configuring Database:
To create a database open a browser and go to http://localhost/phpmyadmin/. Create a database. I have created a database in name “example”.
To configure database open “database.php”, this is located in “/application/config/” relative to your root directory of CodeIgniter, for us, that would be “C:wampwwwCodeIgniterapplicationconfig”
On line 51, you will notice:
$db[‘default’][‘hostname’] = ‘localhost’;
$db[‘default’][‘username’] = ”;
$db[‘default’][‘password’] = ”;
$db[‘default’][‘database’] = ”;
$db[‘default’][‘dbdriver’] = ‘mysql’;
Change above these to
$db[‘default’][‘hostname’] = ‘localhost’;
$db[‘default’][‘username’] = ‘root’;
$db[‘default’][‘password’] = ”;
$db[‘default’][‘database’] = ‘ example ‘;
$db[‘default’][‘dbdriver’] = ‘mysql’;