PHP
  Home arrow PHP arrow Page 2 - Introduction to the CodeIgniter PHP Fr...
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Introduction to the CodeIgniter PHP Framework
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2008-08-13

    Table of Contents:
  • Introduction to the CodeIgniter PHP Framework
  • Start using CodeIgniter
  • Activating support for MySQL databases
  • Developing the first application with Code Igniter

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introduction to the CodeIgniter PHP Framework - Start using CodeIgniter


    (Page 2 of 4 )

    Obviously, the first step that you should take before using Code Igniter is installing its source files into your test web server. To do so, simply point your browser to the following url: http://codeigniter.com/downloads/. Download the ZIP file that contains these files.

    Once you've accomplished this, unzip the package and upload its folders and files to a chosen directory of your web server. In my personal case, I saved it to a “/codeigniter/” directory under the server’s root, but you may want to select a different location.

    Finally, navigate to the application/config/config.php file, then open it with your code editor and configure the following array settings, as shown below:


    |--------------------------------------------------------------------------

    | Base Site URL

    |--------------------------------------------------------------------------


    $config['base_url'] = "http://127.0.0.1/codeigniter/";



    |--------------------------------------------------------------------------

    | Index File

    |--------------------------------------------------------------------------


    $config['index_page'] = "index.php";



    |--------------------------------------------------------------------------

    | Default Language

    |--------------------------------------------------------------------------


    $config['language'] = "english";



    |--------------------------------------------------------------------------

    | Default Character Set

    |--------------------------------------------------------------------------


    $config['charset'] = "UTF-8";



    |--------------------------------------------------------------------------

    | Cache Directory Path

    |--------------------------------------------------------------------------


    $config['cache_path'] = 'http://127.0.0.1/codeigniter/cache/';



    |--------------------------------------------------------------------------

    | Session Variables

    |--------------------------------------------------------------------------


    $config['sess_cookie_name'] = 'ci_session';

    $config['sess_expiration'] = 7200;

    $config['sess_encrypt_cookie'] = FALSE;

    $config['sess_use_database'] = FALSE;

    $config['sess_table_name'] = 'ci_sessions';

    $config['sess_match_ip'] = FALSE;

    $config['sess_match_useragent'] = TRUE;

    $config['sess_time_to_update'] = 300;



    |--------------------------------------------------------------------------

    | Global XSS Filtering

    |--------------------------------------------------------------------------


    $config['global_xss_filtering'] = FALSE;



    |--------------------------------------------------------------------------

    | Output Compression

    |--------------------------------------------------------------------------


    $config['compress_output'] = TRUE;



    |--------------------------------------------------------------------------

    | Rewrite PHP Short Tags

    |--------------------------------------------------------------------------


    $config['rewrite_short_tags'] = FALSE;


    As you can see, the above settings provide Code Igniter with crucial information about your web applications, including the base url of your site, the default language and character set, and the index file that will be utilized. Also, it’s possible to specify whether any output generated by an application should be filtered to prevent XSS attacks, and whether it should be cached and compressed previously.

    Finally, there’s a number of simple options that tell Code Igniter how to handle session data. They are actually fairly easy to configure. Although, you should pay special attention to the following entries:


    $config['sess_use_database'] = FALSE;

    $config['sess_table_name'] = 'ci_sessions';


    If a value of “TRUE” is assigned to the first array element, then Code Igniter will store all of your session data in a MySQL database table, whose name will be specified in the second entry. In this case, a FALSE value has been assigned to the first setting, meaning that session data will be saved to a temporary directory in the web server.

    Lastly, it’s possible to configure whether the use of short PHP tags will be enabled within view files. This is something that will be discussed in more detail when I develop some sample applications for you. For now, I’ll keep this option disabled.

    So far, so good. I showed how to configure the main entries of Code Igniter’s config.php file. Of course, when you edit the file in question, you’ll see that it contains a few additional settings. However, to keep things rather simple, I’m going to use only the ones discussed above.

    Now that the “config.php” file has been properly setup, it’s time to move on and learn how to configure an additional file, which is located at /config/database.php and is used by Code Igniter when working with MySQL databases.

    To see how this database file will be edited, please click on the link below and read the following section.

    More PHP Articles
    More By Alejandro Gervasio


       · Code Igniter is a powerful, easy-to-setup PHP framework that lets developers build...
       · CodeIgniter is a very easy framework to get into and it's great to see this...
       · Thank you for the suggestions about Kohana framework. I think they’ll be useful for...
       · I have been coding PHP and just learn CI Framework, i think it's useful especially...
       · Thanks for commenting on my CI article. If you’re learning how to implement the MVC...
       · Zend is not a framework...'ZEND Framework', however, is a framework. 'ZEND' can be...
       · Thanks for commenting on my CI article. Actually, Zend is a framework and not ZEND....
       · thank you for the tutorial system. I am shocked at how ungrateful some people are....
       · Thanks for the words on my CI article. I really appreciate your recognition on my...
       · Am simply reiterating the message extended by Zend Technologies and those developing...
       · Helpful contribution, indeed. While being appreciated, it's rather irrelevant with...
       · I've been 'playing around' with PHP fopr a while now, and CI is my first dip in the...
       · Thanks Martin for the words on my series on using CI's main features. Glad to know...
     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT