# How to install CodeIgniter on Ubuntu?

## Introduction

The following has been tested on a Cloud9 server with the following versions:

## Server configuration

The first step is to upgrade PHP. It's not mandatory, but I strongly recommand to use the same PHP version on your local development machine and on your production server. In my case, my server is based on PHP 7.2. The following link explains how to upgrade PHP to 7.2:

How to upgrade PHP to 7.2 on Ubuntu?

or

$config['base_url'] = 'https://localhost/'; ## Database configuration Open the application/config/database.php file and set your database settings: //application/config/database.php // Hostname of your SQL server 'hostname' => 'localhost', // Set the username of your SQL server 'username' => 'myUserName', // Set the password associated the the previous user 'password' => '********', // Set the database name (create a DB with phpMyAdmin if necessary) 'database' => 'myDatabaseName', ## Security I strongly recommand to use a PDO driver instead of mysqli for increased security: //application/config/database.php // Set PDO driver 'dsn' => 'mysql:host=localhost; dbname=CodeIgniter; charset=utf8;', 'dbdriver' => 'pdo', I also recommand to rename the folders system and application. Once renamed, open your main index.php file and set the $system_path and $application_folder variables at the top of the file with the new name you’ve chosen. ## Emails configuration If your application sends email, and messages are always send via the same server, I recommand to configure email at the application level. Create a file named email.php in /application/config. Set your email settings in the file as in the following example: <?php //applications/config/email.php$config['protocol']     = 'smtp';
$config['smtp_host'] = 'mail.smtp_host.com';$config['smtp_port']    = '465'; // 8025, 587 and 25 can also be used. Use Port 465 for SSL.
$config['smtp_crypto'] = 'ssl';$config['smtp_user']    = 'username';
$config['smtp_pass'] = 'password';$config['charset']      = 'utf-8';
$config['mailtype'] = 'html';$config['newline']      = "\r\n";

Detailled list of parameters can be found in CodeIgniter documentation.

## Run CodeIgniter

Start your server and go to the home page. If everything is fine, you should have the following welcome page: