-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Installation
These instructions assume that you already have a working Linux-Apache-MySQL-PHP (LAMP) stack. They include examples for Debian 7 and CentOS 7 platforms.
If wget is not already installed on your platform, then install it now.
On Debian 7:
sudo apt-get install wget
On CentOS 7:
sudo yum install wget
Change to the directory where you are going to save your downloads, and download the CodeIgniter archive:
cd ~
wget https://github.com/bcit-ci/CodeIgniter/archive/2.2-stable.zip
If unzip is not already installed, then install it now (with sudo apt-get install unzip
or sudo yum install unzip
, as appropriate).
Unzip the compressed archive:
unzip 2.2-stable.zip
This will create a directory with a name such as CodeIgniter-2.2-stable.
###Configure CodeIgniter general settings
Open the CodeIgniter-2.2-stable/application/config/config.php
file with a text editor, and set the base URL of your website. For example:
$config['base_url'] = 'http://www.example.com/';
If you intend to use encryption or sessions, then set the encryption key to a random, 32-character. For example:
$config['encryption_key'] = 'UEmQQkxr9o6qJ054rWh3feD2admpiK6O';
Save the CodeIgniter-2.2-stable/application/config/config.php
file with the above changes.
###Configure CodeIgniter database settings
If you intend to use a database, edit the database settings in the CodeIgniter-2.2-stable/application/config/database.php file
. For example:
'hostname' => 'localhost',
'username' => 'exampleuser',
'password' => '6SPLwbEuQTK9v36H',
'database' => 'exampledb',
'dbdriver' => 'mysqli',
###Secure CodeIgniter
For the best security, both the system and application folders should be placed above the web root, so that they are not directly accessible via a browser.
Open the CodeIgniter-2.2-stable/index.php
file and set the $system_folder
and $application_folder
variables.
For example, if you are using the default web root on Debian 7:
$system_path = '/var/system';
$application_folder = '/var/application';
If you are using the default web root on CentOS 7:
$system_path = '/var/www/system';
$application_folder = '/var/www/application';
###Copy CodeIgniter to your web server
Copy the CodeIgniter materials to your web server.
On Debian 7, if you are using the default web directory of /var/www
, then execute the commands:
sudo cp -f CodeIgniter-2.2-stable/index.php /var/www/
sudo rm /var/www/index.html
sudo cp -rf CodeIgniter-2.2-stable/application /var/
sudo cp -rf CodeIgniter-2.2-stable/system /var/
On CentOS 7, if you are using the default web directory of /var/www/html
, then execute the commands:
sudo cp -f CodeIgniter-2.2-stable/index.php /var/www/html/
sudo cp -rf CodeIgniter-2.2-stable/application /var/www/
sudo cp -rf CodeIgniter-2.2-stable/system /var/www/
###Test the install
Now open a browser and navigate to your web site. For example:
http://www.example.com/
You should see the CodeIgniter default Welcome page.