October 15, 2014 2:50 pm

How to install and Configure CodeIgniter Framework

CodeIgniter is one of the most popular PHP frameworks around. It uses the Model-View-Controller Architectural design pattern and it’s considered by lots of PHP developers as one of the best framework solution for small to medium projects. In this article we will cover how to install CodeIgniter and we will view the most common configuration abilities of the famous MVC framework.

Why Codeigniter Framework is Better than Custom PHP Development

How to Install

The installation itself is such a simple process. First of all, you need to download the CodeIgniter zipped file, upload it to your server and extract it into your home directory. You can download it from https://ellislab.com/codeigniter/user-guide/installation/downloads.html.

Configuring CodeIgniter

Congratulations, now you have CodeIgniter installed on your server. Now it’s time for configuration. Open the application/config/config.php file with your preferred editor and set your base URL. If you intend to use encryption or sessions, set your encryption key. For the database configuration, open the application/config/database.php file with your preferred editor and set your database host, name, user, password and other values that you think it will help you connect to your database. You will find array variables with comments to know the role of each value.

The Configuration files

By editing the two previously mentioned files, you are ready to start coding your first web application but CodeIgniter contains more files that enable more configuration and customization abilities. The configuration files can be found in the application/config/ directory. The following is a quick description of what you can do by editing some of the most commonly used configuration files:

– autoload.php: specifies which systems (Packages, Libraries, Helper files, Custom config files, Language files and Models) should be loaded by default.

– config.php: contains all website configuration.

– constants.php: contains defined constants which are used when checking and setting modes when working with the file system.

– database.php: contains the settings needed to access your database.

– email.php: This file is not created by default. But you can create it and set the default values for the email class. Like: mailtype, charset, newline, protocol, smtp_host, etc.

– hooks.php: lets you define “hooks” to extend CI without editing the core files.

– mime.php: contains an array of mime types. It is used by the upload class to help identify allowed file type.

– routes.php: lets you re-map URI requests to specific controller functions.

– smileys.php: contains an array of smileys for use with the emoticon helper.

– upload.php: This file is not created by default. But you can create it and set the default values for the upload class. Like: upload_path, allowed_types, max_size, max_width, max_height, etc.

– user_agents.php: contains four arrays of user agent data. It is used by the User Agent Class to help identify browser, platform, robot, and mobile device data. The array keys are used to identify the device and the array values are used to set the actual name of the item.

Now, we have viewed the most common CodeIgniter configuration files. Next, we will work on writing your first web application using CodeIgniter framework.

Books to read

CodeIgniter 2 Cookbook

Professional CodeIgniter

CodeIgniter for Rapid PHP Application Development

Author Amr Abdou

A full-stack web developer, Linux enthusiast, freelance tech writer & open-source supporter. Loves finding quit corners in public places or cafes accompanied by his laptop to try changing the world from there. You can check his latest works at social-evolvea.com or follow him on facebook, twitter, Linkedin or Google+


Tutorial Categories:

8 responses to “How to install and Configure CodeIgniter Framework”

  1. Arthur says:

    Thank You for this tutorial. I search for it very long time.
    Will You continue upload tutorials in CI ?

  2. binil billu says:

    Hi thanks for the tutorial about CI. Do you have Yii framework articles please share.

  3. Ghimeray says:

    Hi thanks for the tutorial about CI. Do you have Larvel Symphony framework articles please share

  4. Vikas Rana says:

    how to install cake php ….

  5. prasun says:

    Hi i have a social media site made in php language…In my site I cant change password(the password with which the user log in).Do I need to create a new page for that?And what kind of function do I need to use for that?

  6. Kirit Jbs says:

    Thank you!! it’s very nice to learn!

Leave a Reply

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