The following has been tested on a Cloud9 server with the following versions:
If MySQL is not installed, or if you need to upgrade to a newer version, check this link :
How To Install MySQL on Ubuntu 14.04
If phpMyAdmin is not already installed, install it according to the instructions of the following page:
Keep the password and username for later. We'll need them to configure CodeIgniter.
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?
After upgrade:
username:~/workspace $ php -v
PHP 7.2.10-1+ubuntu14.04.1+deb.sury.org+1 (cli) (built: Oct 1 2018 12:19:38) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-1+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
First check your installed version of MySQL :
mysql -V
To upgrade MySQL, follow these instructions :
Check if Xdebug is installed and properly configured. If not, I strongly recommand to install this powerfull debug tool according to the instructions on the following page:
How to install and configure Xdebug on Ubuntu?
After installation and configuration, the var_dump
function should provide
a formatted display as on the following illustration:
The first think to do is to open the application/config/config.php file and set your base URL:
$config['base_url'] = 'https://www.example.com/';
or
$config['base_url'] = 'https://localhost/';
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',
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.
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.
Start your server and go to the home page. If everything is fine, you should have the following welcome page: