How to install and Configure the CodeIgniter Framework

How to install and Configure the CodeIgniter Framework

Share Now
3 min read

There are a few steps we need to apply in order to install and Configure the CodeIgniter Framework for Cloud server configuration for Codeigniter.

Note: We are considering the installation of codeigniter on Centos 7.

  • Install LAMP
  • Install PHP5
  • Install DB
  • Configure DB
  • Install phpMyAdmin
  • Install Configure
  • Configure Codeigniter
Cross platform Mobile application development company in Chennai

Update the OS

  1. yum update -y

To Install LAMP onCentOS-7

  1. Install Apache with basic config
    1. yum install httpd
  • Use the following commands to manage Apache daemon
    • apachectl configtest| graceful
  • Configure the Firewall
    • Restart the Firewall
      • 1. systemctl restart firewalld
      • 2. firewall-cmd –add-service=http
      • 3. firewall-cmd –permanent –add-service=http
      • 4. firewall-cmd –reload

Note: To allow https, repeat the same step again for sevice https

  • Now, restart the httpd service
    • systemctl restart httpd
  • To check the status
    • systemctl status httpd
  • Now, open browser and type the IP, You will see Apache website

To Install PHP5 support for Apache

  1. To get the full available PHP modules, use this command
    1. yum search php
  • For a normal LAMP server, install the below modules
    • yum install php php-mysql php-pdo php-gd php-mbstring


php-pdo.x86_64 : A database access abstraction module for PHP applications

php-gd.x86_64 : A module for PHP applications for using the gd graphics library

php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling

Install and Configure DB[Here we will use MariaDB]

  1. yum install mariadb-server mariadb -y
  1. Start database daemon and use mysql_secure_installation script
    1. systemctl start mariadb
  2. Configure the Maria DB
    1. mysql_secure_installation
  • To test database functionality login to MariaDB using its root account and exit using quit statement.
mysql -u root -p
MariaDB > quit

Install PHP-MyAdmin

  1. Install the required package for the phpMyAdmin
    1. yum install
  • Install PhpMyAdmin.
    • yum install phpMyAdmin -y
  • Configure PhpMyAdmin to allow connections from remote hosts by editing phpmyadmin.conf file
    • vi /etc/httpd/conf.d/phpMyAdmin.conf
    • Change to below
  • systemctl restart  httpd
Note: If you don`t do the above configuration right, when you access the phpMyAdmin url, you may get error message like
1.Forbidden You don’t have permission to access /phpmyadmin/on this server Job for httpd.service
2. Failed because the control process exited with error code.If you get any of these error, ensure to check the phpMyAdmin.conf file and look for Require IP and Allow from
I got these as an error message while the configuration was not set correctly and once I made the changes as per the screenshot above, those error were not there anymore.
  • Note: If you want to change the URL from http://IP/phpmyadmin to http://IP/some_other_name
    • vi /etc/httpd/conf.d/phpMyAdmin.conf
    • Comment out the default two Alias lines and write your own alias there.
#Alias /phpMyAdmin /usr/share/phpMyAdmin
#Alias /phpmyadmin /usr/share/phpMyAdmin
Alias /some_other_name /usr/share/phpMyAdmin
Change the name from “some_other_name” to any custom name as per the requirement
  • Restart the httpd service.
    • systemctl restart  httpd

Install Codeigniter on the CentOS LAMP

  1. Disable SELINUX

Check the current status


To disable the SeLinux

vi /etc/sysconfig/selinux

Edit with this


Codeigniter database configuration

mysql -u root -p

create database code_db;

CREATE USER codeignitersuser@localhost IDENTIFIED BY ‘password’;

GRANT ALL PRIVILEGES ON code_db.* TO codeigniteruser@localhost;



  • Install composer package manager

If you wish to install CodeIgniter dependencies, you will need composer. It is easy to install with the following commands:

curl -sS | php

mv composer.phar /usr/local/bin/composer

chmod +x /usr/local/bin/composer

  • Install Codeigniter Frameowrk

cd /var/www/html/

yum install -y git

git clone  .

Install the required dependencies

composer install

Change the ownership of the root files to the user apache

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

  • Configure Base URL for Codeigniter, by updating the variables

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

Change $config[‘base_url’] = ”; to $config[‘base_url’] = ‘http://IP’;

  • Configure the DB

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

Edit these info

$db[‘default’] = array(         ‘dsn’   => ”,        
‘hostname’ => ‘localhost’,        
‘username’ => ‘code_db’,        
‘password’ => ‘password’,        
‘database’ => ‘code_db’,       
‘dbdriver’ => ‘mysqli’,
This is just an example as per my lab for codeigniter installation.

These are the steps to be followed to install and Configure the CodeIgniter Framework on the Cloud Server.

Lia Infraservices the leading Mobile App Development company in Chennai, Web Development, DevOps, Digital Marketing, Graphics & UI/UX Design, Cloud Migration Services

Contact LIA Infraservices the leading Mobile App Development Company in Chennai, Web Development, DevOps, Digital Marketing, Graphics & UI/UX Design, Cloud Migration Services.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave comment

Your email address will not be published. Required fields are marked with *.