CodeIgniter set up

This is NOT a basic Codeigniter tutorial, but rather a reminder of the steps to take when setting up a new CI installation.
  1. Basic Installation

  2. Download the latest version (2.1.2 at time of writing).
  3. If you are working with a Cpanel web server, upload the zip file to the server and expand it.  It will expand into it’s own directory.
    Otherwise , simply unzip and upload to where ever you like.
  4. Move the user help files to a local directory.  They are simply a repeat of the manual available on the Codeigniter web site.
  5. Delete the readme, license.txt and everything except the index.php
  6. Create a folder, preferably above the web root, and move the system and application folders into it
  7. Edit index.php
    Add this right at the start
    date_default_timezone_set(‘Pacific/Auckland’);
    change
    l.59
    $system_path = ‘system’;
    to
    /home/username/folder/system/
    l. 75
    $application_folder = ‘application’;
    to
    /home/username/folder/application/Go to index.php and you should see:
  8. Create another folder for publicly accessable assets – css, images, js.  I called mine “public”
  9. Create a .htaccess file for this folder with this code, to prevent any php being executed from these folders
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>
    SetHandler Do_Not_Remove_See
    Options None
    Options +FollowSymLinks
  10. Create a .htaccess file with this code for the public root of your site, ie the folder where you have your index.php
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|public|robots\.txt)
    RewriteRule ^(.*)$ index.php?/$1 [L]
  11. Edit application/config/config.php

    $config[‘index_page’] = ‘index.php’;
    to
    $config[‘index_page’] = ”;

    $config[‘uri_protocol’] = ‘QUERY_STRING’;
    to
    $config[‘uri_protocol’] = ‘AUTO’;

    l. 282 $config[‘global_xss_filtering’] = TRUE;

    $config[‘compress_output’] = TRUE;

    $config[‘rewrite_short_tags’] = TRUE;

  12. application/config/autoload
    Turn on your favourites at this stage, eg database and url
  13. application/config/database.php
    Set the driver to mysqli, and enter your database details
  14. Set up HMVC

  15. Download and unzip the fiiles from https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home
  16. Put MY_Loader.php and MY_Router.php  into the core folder
  17. Put the MX folder into third_party
  18. Put this into config.php
    $config['modules_locations'] = array(
     APPPATH.'modules/' => '../modules/',
    );
  19. Create a folder – applications/modules
  20. Create a folder within modules with then name of your module in lowercase
  21. Within that folder, create folders for models, views, controllers and whatever esle you will be writing
  22. Create a file for the first controller with the same name as the folder. The class should also have the same name, but with an initial capital letter
  23. Edit applicaation/config/routes.php to point to this controller by default
  24. Add any files you normally start with, eg styles.css with your reset (minified) at the top, and your favourite media query breakpoints defined, a folder in the views to contain  template components
  25. Zip up the entire installation and save it as your boilerplate for future productions