PinoyTech.org

CodeIgniter, Kohana, Mootools, jQuery and CSS

How To Set-Up CodeIgniter

Posted by teejay on November 1, 2009

The CodeIgniter framework is one of the easiest frameworks to set-up whether it is on a development server or production server.

What I will try to do is to create a tutorial on how to set it up. This tutorial assumes that you already have set-up a LAMP stack

The first and foremost step is to download the CodeIgniter framework from the source(duh!!).

You will get a zip file. Extract the zip file into the desired location on your web server.

Default CodeIgniter Setup

\system
    \application
        \config
        \models
        \controllers
        \helpers
        \views
        ......
    \cache
    \codeigniter
    \database
    \fonts
    \helpers
    \language
    \libraries
    \logs
    \plugins
    \scaffolding
    index.html
\user_guide

Configuration

The next step is to configure it to run.

Open up config.php located in system/application/config/. Modify the following line to suit you.
$config['base_url'] = "http://example.com/";
// my setup would likely be http://localhost/address_book/

Viewing your application

Open up your browser to the location you specified above and you will see the default welcome codeigniter page. That's it. You ready!

Setting up the database

Most applications now use a database. To set-up Codeigniter to use a database, open up the database.php file in system/application/config/ and modify to suit you.
$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "your_db_username";
$db['default']['password'] = "your_db_password";
$db['default']['database'] = "your_db_name";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
Setting up a framework doesn't get easier and faster than this. If you have any more questions, the CodeIgniter User Guide is a very good documentation on all things CI. And don't forget the forums.

Categories: How To, Web Development

Tags: codeigniter, php

No Comments

Comments