loader image
Tips & Tricks Web Development

Install & Configure The CodeIgniter On Ubuntu 16.04.

While developing web Application we ought to spend lot of time on writing the same code again and again, So working with frameworks likely to reduce our risk factor and definitely will make our work easy. On bright side, We know that CodeIgniter is one of the best PHP driven framework which is helping us to ease our work. Due to some cool features of CodeIgniter like simple interface, libraries, and logical structure to access the libraries, plug-ins, helpers and some other resources which resolves the complex functions of PHP to maintain the high performance. Even it simplifies the PHP code and help us to bring out the fully interactive, dynamic website in short time. So today, am planning to tell you guys how to install codeigniter application on Ubuntu 16.04 and also will cover up complete configuration part.

Support It Extends:

  •   CodeIgniter support PHP 5.2.6 or nearer version,
  •   CodeIgniter support MYSQL 4.1 or nearer version,


Advantage of using this framework:

  • Light Weight frame work.
  • Model-View-Controller Based System.
  • High Performance.
  • Easy code structure.
  • Form and Data Validation.
  • Support image manipulation, etc.

Steps To Install CodeIgniter:

 First navigate to our Apache root folder:

  •     cd /var/www/html

 Download the CodeIgniter stable release from

Extract the downloaded file:
After downloading the zip file, just extract it.

  •    unzip 3.1.5.zip

While extracting the file if you face any problem just check the unzip whether it’s installed or not.
In case if you found it not installed then use the below command to install,


Now will continue with the extracting process. After running all the above commands, if you like to rename the Codegniter then look for the new directory which is named as codeigniter along with its version. Similarly here it is named as CodeIgniter-3.1.5 and so am just renaming the directory CodeIgniter 3.1.5. into CodeIgniter likewise you can name it as you wish.

Follow this command to rename it,


Once the CodeIgniter is successfully installed. you need to set the virtual host in Apache. For that, refer this url to set the virtual host in apache: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04

Once everything is set, we should do some basic configuration. if you’re planning to use db then you should do some basic modification in database.php. This database file will be located at “application/config/database.php” 

After completing the configuration, now save and exit the file.

Tips Of The Day: How To Embed The JW Player Into Website


Defining The URL Structure Of Codeigniter

One of advantage of this CI URL is, that it will have a segment based structure which is more easy for us to understand as you can notice on this link,http://project.com/jwplayer/index.php/controller/method/parameter
controller — segment represents a Controller Class located at application/controllers;
 method –represents the function located in a class
 parameter— represents parameter passed to the method in a class

Use this to pass the simple parameter, 


Steps To Remove Index.php from Url in Codeigniter

Basically the CI url loads the index.php by default and in case if you want to remove the index.php from the url then we should follow the below two 2 steps,

  1. Enable mod_rewrite 
  2. Add .htaccess file in your application.


1) Enable mod_rewrite 

Before doing anything, first check is the mod_rewrite  is enabled are not and incase if not then you use the following command to check it out.


If you found Rewrite_module on the list then its fine you can simply leave it but if its not got enabled then we should enable it by using the following command.


Now we must restart the Apache server to reflect the changes, use the below command to restart the apache,


2) Add .htaccess file

we have almost done with it and now we just have to add the .htacess file in our application. Add .htaccess file at /var/www/html/codeigniter/ and copy & paste the following content in .htaccess file


Best To Read: CRUD operation on Google Spreadsheet using NodeJS

Then we should check the .htaccess file is enabled in Apache config settings or not. and enable to that, set the virtual host file in following way,


OK guys we’re just one step away to finish it, now look for the config file which is located at “application/config/config.php”
And find the following code,


And replace it with this.


Once you done with the above procedure then immediately the index.php file will be removed and the url will look like this,

Yes! we have successfully installed and configured the CodeIgniter Application on Ubuntu 16.04 and now its your turn so just give a try and let us know your experience and queries in the comment box, will surely help you out. parallely, don’t forget to subscribe us to get more blogs & latest updates on your favorite frameworks and from diverse technologies.

For any queries reach us via info@agiratech.com.

The following two tabs change content below.
Allan Watts

Allan Watts

An active software developer with “Can Do” attitude. Around 3.5 years of experience, Allan developing skills in php that allows him to craft flawless web applications in Symfony, Laravel, CodeIgniter, Javascript & WordPress. Also the most accompanied developer for building applications from designer perceptive.

Leave a Reply

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

Join our 30,000+ subscribers, never miss out anything on our latest blogs, tips, tutorials, updates & more.