Codeigniter installation beginner guide

CodeIgniter is one of the most popular PHP frameworks and it follows the MVC pattern. Web Developer can be able to build full-featured web applications with CodeIgniter. This is Codeigniter installation beginner guide tutorial
First download the latest version of CodeIgniter from here: http://www.codeigniter.com/
Extract the zip file and rename the folder. For example CI
Copy and paste the folder at the localhost.
Now run the url           http://localhost/CI
You will see the screen below

codeigniter

Now open your CI folder and your structure will look like this

codeigniter

Now open the application folder and check for the config folder. Open the config folder and open config.php file

Now set the

 $config['base_url']  = ' ';

to

$config['base_url']  = 'http://localhost/CI/';

Now open the file in the same folder name database.php and fill your database details

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'databasename';

Now open the file in the same folder name route.php and replace

$route['default_controller'] = 'Welcome';

to

$route['default_controller'] = 'Mycontroller';

Now open the file in the same folder name autoload.php and do these changes

$autoload['libraries'] = array('database');
$autoload['helper'] = array('custom', 'url', 'form', 'language', 'html', 'file');

Now go back and open the folder controller and create a file name Mycontroller.php and open the file write down the below code in the file.

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
 
class Mycontroller extends CI_Controller {
 
 
	public function __construct() {
 
		parent::__construct();
	}
        public function index()
         {
             $this->load->view('Myview');
        }
}

In the above code Created a class named Mycontroller and extends this class from CI_Controller, Keep in mind that the class name and file name must be same.  Inside the index function we will load the view file.

Now go to the view folder inside application and open the it.(application/views)

Create a file name Myview.php and write some html  and content in the file. In my case I am writing only this line

This is my first view file

Now refresh the url http://localhost/CI/ and check for the output

you will see the output that you have written in your view file. That’s it. You are done with the codeigniter installation.

Hope this article Codeigniter installation beginner guide will help you. Feel free to ask any question.