How to install Codeigniter in Ubuntu

To install CodeIgniter in Ubuntu 16.04

CodeIgniter is a powerful PHP framework built for developers who requires a simple and elegant toolkit for creating web applications. Installation of Codeigniter in Ubuntu is explained in this article.

Features

  • Light Weight, Model-View-Controller Based System.
  • Active Record Database Support.
  • Form/Data Validation, Session Management.
  • Supports Email Sending Class, Image Manipulation Library, File Uploading Class etc.,
  • Maintains Error Logging.
  • Larger help supports and flexible URI Routing.

Download the codeigniter using following link,
https://github.com/bcit-ci/CodeIgniter/archive/3.0.6.zip

Run the following command to install CodeIgniter.

root@linuxhelp:~# wget https://github.com/bcit-ci/CodeIgniter/archive/3.0.6.zip
--2016-07-08 16:48:01--  https://github.com/bcit-ci/CodeIgniter/archive/3.0.6.zip
Resolving github.com (github.com)... 192.30.253.113
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.0.6 [following]
--2016-07-08 16:48:02--  https://codeload.github.com/bcit-ci/CodeIgniter/zip/3.0.6
Resolving codeload.github.com (codeload.github.com)... 192.30.253.120
Connecting to codeload.github.com (codeload.github.com)|192.30.253.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2564043 (2.4M) [application/zip]
Saving to: ‘ 3.0.6.zip’ 

3.0.6.zip              100%[==========================> ]   2.44M  41.0KB/s    in 56s     

2016-07-08 16:48:59 (44.9 KB/s) - ‘ 3.0.6.zip’  saved [2564043/2564043]

Unzip the downloaded file.

root@linuxhelp:~# unzip 3.0.6.zip
Archive:  3.0.6.zip
8082544c5b4b33175790f505587e202e3ca9e488
   creating: CodeIgniter-3.0.6/
  inflating: CodeIgniter-3.0.6/.gitignore  
   creating: CodeIgniter-3.0.6/application/
  inflating: CodeIgniter-3.0.6/application/.htaccess  
   creating: CodeIgniter-3.0.6/application/cache/
.
.
.
.
   creating: CodeIgniter-3.0.6/user_guide/tutorial/
  inflating: CodeIgniter-3.0.6/user_guide/tutorial/conclusion.html  
  inflating: CodeIgniter-3.0.6/user_guide/tutorial/create_news_items.html  
  inflating: CodeIgniter-3.0.6/user_guide/tutorial/index.html  
  inflating: CodeIgniter-3.0.6/user_guide/tutorial/news_section.html  
  inflating: CodeIgniter-3.0.6/user_guide/tutorial/static_pages.html  

check the files using “ ls” command.

root@linuxhelp:~# ls
3.0.6.zip  CodeIgniter-3.0.6

Rename the extracted directory

root@linuxhelp:~# mv CodeIgniter-3.0.6 codeigniter
root@linuxhelp:~# ls
3.0.6.zip  codeigniter

Copy the unzipped file to “ /var/www/html/” directory.

root@linuxhelp:~# cp -R codeigniter /var/www/html/codeigniter

Then restart the apache2 service by using following command.

root@linuxhelp:~# service apache2 restart
root@linuxhelp:~# service apache2 status
 apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2  bad  vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           ??apache2-systemd.conf
   Active: active (running) since Fri 2016-07-08 16:53:07 IST  8s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3593 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 3619 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
    Tasks: 6 (limit: 512)
   CGroup: /system.slice/apache2.service
           ??3636 /usr/sbin/apache2 -k start
           ??3639 /usr/sbin/apache2 -k start
           ??3640 /usr/sbin/apache2 -k start
           ??3641 /usr/sbin/apache2 -k start
           ??3642 /usr/sbin/apache2 -k start
           ??3643 /usr/sbin/apache2 -k start

Jul 08 16:53:06 linuxhelp systemd[1]: Starting LSB: Apache2 web server...
Jul 08 16:53:06 linuxhelp apache2[3619]:  * Starting Apache httpd web server apache2
Jul 08 16:53:07 linuxhelp apache2[3619]:  *
Jul 08 16:53:07 linuxhelp systemd[1]: Started LSB: Apache2 web server.

Open browser and type http://< local_host> /codeigniter or http://< IP_address> /codeigniter

Comment
patrickmole
Jul 01 2018
I have an error cp: cannot create directory '/var/www/html/codeigniter': Permission denied
samsonkasambala
May 10 2018
I have followed all the steps but am getting an error when trying to start CI. Below is the part of the error which i am getting. =')) { error_reporting(E_ALL
ravijatav
Jul 30 2017
thanks
Add a comment
FAQ
Q
How you can enable CSRF (Cross Site Request Forgery) in CodeIgniter?
A
You can activate CSRF (Cross Site Request Forgery) protection in CodeIgniter by operating your application/config/config.php file and setting it to
$config [ ‘csrf_protection’] = TRUE;
Q
how you can extend the class in Codeigniter?
A
To extend the native input class in CodeIgniter, you have to build a file named application/core/MY_Input.php and declare your class with
Class MY_Input extends CI_Input {
}
Q
What is Codeigniter?
A
CodeIgniter is a powerful PHP framework built for developers who require a simple and elegant toolkit for creating web applications.
Q
What is a controller in the CodeIgniter framework?
A
1.controller is a class that helps delegate work.
2. It works as a glue for a web application. It takes incoming HTTP requests and processes them.
Q
Why is there a need to configure the URL routes?
A
Follow this instruction:
1. From SEO point of view, to make URL SEO friendly and get more user visits
2.Hide some URL element such as a function name, controller name, etc. from the users for security reasons
3.Provide different functionality to particular parts of a system