CodeIgniter is a PHP framework used to build web applications that are widely used by developers worldwide. Before you install CodeIgniter, make sure the following are installed beforehand:

  • Webserver Apache or Nginx
  • PHP 5.6
  • MySQL
  • Composer

Once you confirm that the above-listed components are on your server, proceed to install CodeIgniter with the following steps.

Step 1: Set SELinux status to disabled.

# SELINUX=disabled

Step 2: Let us create a MySQL Database for CodeIgniter.

# create database mycode_db;
# GRANT ALL PRIVILEGES ON mycode_db.* TO 'mycodeusr'@'localhost' IDENTIFIED BY 'your_password';
# flush privileges;
# exit

Step 3: Now, we will install Composer Package Manager.

# curl -sS https://getcomposer.org/installer | php
# mv composer.phar /usr/local/bin/composer
# chmod +x /usr/local/bin/composer
# exit

Step 4: We will install CodeIgniter. Go to the root directory of HTML.

# cd /var/www/html/

Step 5: Clone CodeIgniter from its git repository.

# git clone https://github.com/bcit-ci/CodeIgniter.git

git_clone-min.png

Step 6: We will install the required dependencies by running composer.

# composer install

Step 7: Provide file ownership of files to the Apache user.

# chown -R apache:apache /var/www/html/

Step 8: We will configure the base URL by editing the config.php file.

# vi /var/www/html/application/config/config.php

Step 9: Locate the line below.

config['base_url'] = '';

Step 10: Modify this line by adding your application URL in the quotes.

config['base_url'] = 'http://192.168.2.152';

Step 11: To configure the CodeIgniter Database connection setting, edit the following file with your preferred text editor:

# vi /var/www/html/application/config/database.php

Step 12: Locate the path given below: 

$db['default'] = array(
'dsn'   => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'dbdriver' => 'mysqli',

Change it to:

$db['default'] = array(
'dsn'   => '',
'hostname' => 'localhost',
'username' => 'mycode_db',
'password' => 'your-db-user-password',
'database' => 'mycodeusr',
'dbdriver' => 'mysqli',

Step 13: Once you are done with the changes, save this file. Access the URL (http://192.168.2.152) you added earlier in base_url and verify that CodeIgniter is working.

Was this answer helpful? 0 Users Found This Useful (0 Votes)