Menu

CodeIgniter (CI) Installation and Configuration

CodeIgniter (CI) Installation and Configuration

We have share in this tutorial how to install and configuration codeigniter. CodeIgniter is an open source Web Application framework built in PHP designed to make your life as a programmer easier, while allowing you good speed for development, and also good performance when the site is up and running.

  • Easy to install and configure

  • Clean and elegant MVC implementation

  • Uses Active Record pattern for database access

  • Overall small footprint and good performance


Requirements


CodeIgniter framework.
Any Apache/PHP/MySQL (Like: LAMP, WAMP, XAMPP). You can install the applications independently, or install one of those packages that have all of them bundled together.

How to install and configuration codeigniter. See the following Steps



Step 1 : Download CodeIgniter

Download current version of CodeIgniter framework.

Step 2 : Installing CodeIgniter:

To install CodeIgniter, you only need to Unzip the package to the htdocs {OR} www directory of your Web Server.

nfig.php file with text editor and set base URL.

Syntax:
//you can set base URL
$config['base_url'] = "http://localhost/codeigniter/";

Step 4 : Testing CodeIgniter
Then check CodeIgniter application running properly
http://localhost/codeigniter


 //Database configuration
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root', // Your username if required.
'password' => '', // Your password if any.
'database' => 'test_DB', // Your database name.
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);


Step 5 :CodeIgniter .htaccess and URL rewrite
1- Make below changes in application/config/config.php file


$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

2- Make .htaccess file in your root directory using below code

DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]


3- Enable the rewrite engine (if not already enabled)

Ads middle content1

Ads middle content2