How to install Codeigniter step by step tutorial

CodeIgniter is a PHP based applications development framework. It provides MVC structure for build fast and neat and clean coding structure. If you know PHP language codeigniter is best tool for build a website from scratch and it is very secure too. So let we start how to install codeigniter on localhost or on server. Let’s begain:

1. Download the codeigniter package :

Firstly you need to go  https://codeigniter.com/download and there are three versions of codeigniter you can download 3.x version. 3.1.9 is the current version of the framework. It may in zip folder.

2. Extract files in root OR your project folder

Now Extract CI zip folder on the root folder of your website hosting or in project folder on localhost. You can see file structure after extract.

Now go to your-domain.com or localhost URL like http://localhost/your-project. You can see this page on browser.

3. Now the next step is configuration for CI project. There are four files to use for configure.

  1. config.php
  2. database.php
  3. routes.php
  4. autoload.php

All these files are in application/config folder. Open config.php file and set base_url and index_page in config.php.

Now open database.php for configure your database connectivity.

Next open routes.php for defined your default_controller and other routes. for explain this i will create a new article on it.

Now last one autoload.php where we need to defined libraries and helpers. check this code:

These libraries like database,email and session it is very necessary for any project. and second is helper if you don’t define URL helper and file helper you can’t use base_url parameter.

4. Update .htaccess file on project root folder

Now create .htaccess file on root for remove index.php from URL. Just copy and paste this code.

 

5. Take a look on a simple example :

Now question is how we can use MVC structure in codeigniter. Open application/ folder and you can see there three folders Models, Views, Controllers.

After all these database and configuration settings now you can do easily insert, update, delete activities. If you want to learn how to create CRUD functionality using codeigniter you can check out my next article CRUD operation in codeigniter step by step.

Thanks for reading Happy Learing 🙂

Add a Comment

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