CodeIgniter Setup


CodeIgniter is a small and fast PHP framework. Not all of these steps are necessary to use the framework, but they result in a more secure setup where none of the framework files are ever web accessible.

  1. Download the .zip
  2. Create a public/ directory at the same level as the system/ directory containing asset directories: mkdir public public/images public/javascripts public/stylesheets
  3. Move the index.php file into the public/ directory: mv index.php public
  4. Edit the index.php file to reflect it’s new location: :%s/$system_folder = "system";/$system_folder = "..\/system";/
  5. Inside of system/application/config/config.php:
    1. Set the 'base_url' to your sites URL
    2. Clear the 'index_page' config (set it to the empty string)
    3. 'enable_query_strings' if necessary
    4. Adjust the 'log_threshold'
    5. Choose a unique 'encryption_key'
    6. Turn 'sess_encrypt_cookie' on
    7. At the end of config.php add:
      // optionally load (and potentially override) additional config values
      if (file_exists('../system/application/config/config.local.php'))
      {
          include('config.local.php');
      }
  6. Create (and promptly SVN ignore, if applicable) a config.local.php file. The file will usually only contain overrides for ‘base_url’, ‘index_page’, ‘log_threshold’, and ‘log_path’.
  7. Fill out the database.php config file as necessary, potentially with a companion database.local.php file as well.
  8. If you wish to remove the index.php from you URLs, create a .htaccess file like so:
    RewriteEngine On
    RewriteCond $1 !^(index\.php|images|stylesheets|javascripts|favicon\.ico|robots\.txt)
    RewriteRule ^(.*)$ /fresh/index.php/$1 [L]
  9. Point your document root to the new public/ directory and you’re off!

No Comments

No comments yet.

Comments RSS TrackBack Identifier URI

Leave a comment


powered by WordPress     themed by Mukkamu     presented by ideaharbor.org     everything else by steve hulet