How to Install CodeIgniter in CentOS 7/6

CodeIgniter is an Open-Source and powerful PHP framework. It is used to develop web applications which are very small but very powerful. CodeIgniter’s helps people to write their own applications which is much faster and easier by providing useful libraries.

This tutorial will help you to install CodeIgniter on CentOS system.

Step 1: Prerequisites

CodeIgniter framework required PHP, MySQL and Apache/Nginx on the system. Use one the following tutorial to install LAMP server on your system.

Step 2: Download and Extract CodeIgniter

Now use mention steps to download the CodeIgniter also you can download the CodeIgniter from the official website.

# cd /var/www/html
# wget

Extract the archive file and place in document root.

# unzio
# mv CodeIgniter-3.1.9/ codeigniter

Step 3: Create Database

Now connect MySQL with root and create the database for CodeIgniter.

# mysql -u root -p
mysql> create database codeigniter;
mysql> GRANT ALL ON codeigniter.* TO 'codeigniter'@'localhost' IDENTIFIED BY 'redhat';
mysql> quit

Step 4: Configure CodeIgniter

After creating the database, edit database configuration file and update the database setting.

# vim /var/www/html/codeigniter/config/database.php
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'codeigniter',
'password' => 'redhat',
'database' => 'codeigniter',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE

Now configure the base URL for your application.

# vim /var/www/html/codeigniter/config/config.php

update base_url with your domain name:

$config['base_url'] = '';

Step 5: Configure Apache

As we are using Apache, so create apache virtual host for your CodeIgniter.

# vim /etc/httpd/conf.d/codeigniter.conf 
<VirtualHost *:80
DocumentRoot /var/www/html/codeigniter
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/html/codeigniter">
Options Indexes FollowSymLinks
AllowOverride All
Allow from all
Require all granted

Step 6: Access CodeIgniter

You have successfully setup CodeIgniter. Now you can access CodeIgniter application in your browser and start developing from CodeIgniter.

Codeigniter Linux

Enjoy it!

  1. 4 years ago

Leave a Reply

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.