How To Install Codeigniter

Install Codeigniter Step by Step Configurations

After developing a few web projects you will feel that you spent most of doing the same things.Like authentication, templating and database queries. To overcome these drawbacks a framework comes in very use full to provide basic parts for you to work.

Install Codeigniter:

Codeigniter is very powerful and popular PHP (MVC) based framework.Install Codeigniter is very easy first you need to Download Codeigniter 3.xx stable version from its official website.

Download Codeigniter Stable Version

Extract codeigniter (zip or archive) folder and place folder under www directory of your server and rename folder like my-codeigniter-app or whatever name you want.

Next we need to setup the configuration for database, libraries and helper etc.Below is the directory structure of Codeigniter config files.

config.php:

Open config file to set some parameters that are required to run the application successfully.
my-codeigniter-app/application/config/config.php
Base URL
First one set base URL that will be the absolute path of your project root directory, like for phpclicks base url will be
http://phpclicks.com/ for production environment you will place your domain name.
Or for local URL
http://localhost/ my-codeigniter-app/
We never rely on auto guessing the base url we must define it specially in a production environment.
Prototype for local Environment :

Prototype for Live Environment :

Default Language
By default it’s use English, but if you want to use some other language then make sure it’s available in your language folder.

Hooks
If you are going to use hooks in your application you should set it true by default it will be false.

Encryption Key
If we want to use encryption class, then we must need to set encryption key. It may be any random string with different characters, integers and special characters etc.

If we want to use encryption class, then we must need to set encryption key. It may be any random string with different characters, integers and special characters etc.

database.php:

Open the database.php file from config folder “my-codeigniter-app /application/config/database.php”
This file will contain the settings that needed to access your database.

There will be $db[‘default’] array just set there your host name , user name ,password and database name.
Prototype:

constant.php:

There is contstant.php file you can define constant if you required and get that constant anywhere in your application.
my-codeigniter-app/application/config/constant.php

You can get MY_ROLE constant inside views, controllers, models or anywhere you want in your application.

autoload.php:

Next one is configuring the packages (libraries , helpers , models etc) that you want systems should be loaded by default.To keep the framework as light-weight as possible only the absolute minimal resources are loaded by default.In this file you can globally define which files(library,model,helper etc) you would like loaded with every request.This one is the final configuration to complete install Codeigniter.Things that you can load automatically with every request are:

-> Packages
-> Libraries
-> Drivers
-> Helper files
-> Custom config files
-> Language files
-> Models

Auto-load Packages Prototype:

Auto-load Libraries
These are the classes located in “system/libraries/” or your “application/libraries/” directory, with the addition of the ‘database’ library, which is somewhat of a special case.
Prototype:

You can make an Alies of library name in as well.

Auto-load Helper Files Prototype:

Auto-load Models Prototype:

You can also supply an alternative model name as alias to be assigned in the controller like “user_auth” model alias is phpclicks :

Note : Now we have just finished the install codeigniter and further might be update some other configuration according to our requirements.

Feel free to ask questions just leave us a comment and we will get back to you.