Codeigniter Installation (from Windows 10 to Online server)

1) Go to 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/
9) If you are moving it to server, create zip file of all these files and upload zip file on host and extract it.
11) 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.)

12) In /app/Config/App.php file, add public $baseURL = ‘’
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.)
13) Create a new database on server and in database.php file, you can enter database login details.

14) Further detailed steps on working on codeigniter can be read further here:

15) 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 Ajax

1. Create mysql table:

  `title` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)

2. Create controller ‘Pages.php’

db = db_connect();
  		// Loading Query builder instance
  		$this->builder2 = $this->db->table("items");

    public function my_view()
        echo view('my_view', $data);
    public function ajaxRequestPost()

        $title = $_POST['title'];
        $description = $_POST['description'];

			"title" => $title,
			"description" => $description,

        echo 'Added successfully.';

3. Create view file ‘my_view.php’


query("SELECT * FROM items"); $result5 = $query->getResultArray(); if($result5) { foreach ($result5 as $item) { ?>
Title Description

Ajax code in View sends form data to controller function ajaxRequestPost() and this controller sends data mysql database.

To make it work properly do basic settings like database connectivity and minor bug fixes.

Contact for tasks in Codeigniter.