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.
Syntax:
1 2 3 4 |
<?php //you can set base URL $config['base_url'] = "http://localhost/codeigniter/"; ?> |
Step 4 : Testing CodeIgniter
Then check CodeIgniter application running properly
1 |
http://localhost/codeigniter |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
//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
1 2 3 4 5 |
<?php $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
1 2 3 4 5 6 7 |
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)