Let’s follow some easy steps to install Codeignighrter.
Step 1: Download Codeigniter from the following website ‘https://www.codeigniter.com/userguide3/installation/downloads.html’.
Step 2: choose the current version or other according to your requirements. Here I am going with the latest version.
Step 3: Start Download
Step 4: Extract the folder
Step 2: Extract the zip folder.
Step 4: Set Base URL in application/config/config.php file.
Step 5: Set database configurations.
Step 6: Everything is set up now we can start developing our application.
Step 7: Goto localhost/CodeIgniter and you can already see your homepage of Codeigniter
CodeIgniter - Configuration
As we discussed before Codeigniter needs zero-configuration, the only necessary configuration like database and base URLs, and the rest is autoloaded
The base URL can be found in the application/config/config.php file. Which looks like this http://Project-name.com/
If we don't set the base URL Codeigniter will keep guessing for it so it is always good to set your base URL first, to set the base URL we need to make changes in the $config array in the config file like this $config['base_url'] = 'http://your-domain.com';
That’s it for Urls now let’s move onto Database configuration
The database configuration can be found in the application/config/database.php file.
With the help of the CodeIgniter framework, we can set up our database on the different environments like deployment or production
Let’s have a look at the configuration settings −
$db['test'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => 'root', 'password' => '', 'database' => 'database_name', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => TRUE, 'db_debug' => TRUE, 'cache_on' => FALSE, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'encrypt' => FALSE, 'compress' => FALSE, 'stricton' => FALSE, 'failover' => array() );
Here are some important configurations of CodeIgniter :
Hostname: by default hostname will be your localhost, we can easily change this while deploying the project.
Username: this is the username for the application, with the default name root.
Password: We can set a password for the application if we want here for extra security.
Database: database is set here just by adding the name of your database.