Learn Codeigniter

CodeIgniter is a powerful PHP framework. It has powerful features. It provides a simple and elegant toolkit to create full-featured web applications. Its predefined toolkit coding files sizes only to few MBs and so CodeIgniter performs exceptionally fast. CodeIgniter encourages MVC (or Model View Controller structure) for its implementation.

CodeIgniter also provides built-in protection against CSRF and XSS attacks. As a addition to security, it also provides context-sensitive escaping and Content Security Policy(CSP).

It has pre-defined documentation and how to guides to understand different components that make up the framework. Components have pre-defined rules and configuration so there is little more needed to modify options as per the need of project.

Latest version of CodeIgniter requires latest version of PHP installed. CodeIgniter supports following databases:

  • MySQL
  • Oracle
  • PostgreSQL
  • SQLite
  • Interbase/Firebird
  • ODBC

To install codeIgniter you can download it manually from the CodeIgniter website or you can install it in your project folder using Composer command.

CodeIgniter Installation

1) Go to codeiginiter.com and install latest version of codeigniter.
2) Download and install XAMPP
3) Download and install Atom
4) Run Xampp’s Apache server
5) In Atom, install command line package
6) In Atom, install ‘Script’ package.
7) Run composer installation commands in Atom from:
(If you get error php is not recognized, do following:
In you system (Windows 10) , search and right click on ‘This PC’, click properties.
Search ‘Edit the system environment variables’.
In advanced tab, click on ‘Environment variables’ button. Click ‘New’ and add PHP.exe file path. Add path of PHP file: C/XAMPP/PHP/PHP.exe
After that close atom and open it again. And try running composer installation commands again.)
8) Run CodeIgniter installation from:
It will make CodeIgniter run on browser by typing address localhost:8080/

Move CodeIgniter project from Windows local setup to Online server

1) If you are moving it to server, create zip file of all these files and upload zip file on host and extract it.
2) Index file is in Public folder. So in root directory, there is need to give path in .htdocs file, add this line at bottom to point to that file:

DirectoryIndex /public/index.php

(Any errors can be seen in public/error_log text file.)

3) In /app/Config/App.php file, add public $baseURL = ‘https://yourwebsitename.com/’
It will make the website run on your website domain name.

(If it shows 500 error, upgrade latest version of PHP on server for this domain.)
4) Create a new database on server and in database.php file, you can enter database login details.

5) Further detailed steps on working on CodeIgniter can be read further here: https://codeigniter.com/user_guide/tutorial/index.html

6) When adding multiple pages on live server, there is need to add this code on top of .htdocs file, in root directory:

RewriteEngine On

RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC]
RewriteRule ^ %1 [L,NE,R=302]

RewriteRule ^((?!public/).*)$ public/$1 [L,NC]

Codeigniter coding tutorial: https://codeigniter.com/user_guide/tutorial/index.html

Watch a demo project created in CodeIgniter. Contact for tasks in CodeIgniter.

Leave a Reply

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