Skip to content
Search
  • ServicesPage
  • Our workPage
  • BlogPage
  • AI solutionsPage
  • Contact usPage
All articles

Configuring CodeIgniter in your localhost with WAMP server

Masum · · 1 min read · CodeIgniter

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”

Configuring CodeIgniter in your localhost with WAMP server

On line 17, you will notice:

code
$config['base_url'] = "";

Change blank URL to the URL of your CodeIgniter install server URL, so it should be:

code
$config['base_url'] = "http://localhost/CodeIgniter/";

See image below:

Configuring CodeIgniter in your localhost with WAMP server

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 CodeIgniter in your localhost with WAMP server

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”.

Configuring CodeIgniter in your localhost with WAMP server

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”

Configuring CodeIgniter in your localhost with WAMP server

On line 51, you will notice:

code
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '';
$db['default']['password'] = '';
$db['default']['database'] = '';
$db['default']['dbdriver'] = 'mysql';

Change above these to

code
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = ' example ';
$db['default']['dbdriver'] = 'mysql';

Have a project in mind?

Tell us what you need. We get back to you as soon as possible.

Start a project