In this tutorial we will show you how to install and configuration of CodeIgniter on your Ubuntu 14.04 server. For those of you who didn’t know, CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.
This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation CodeIgniter on Ubuntu 14.04 server.
Install CodeIgniter on Ubuntu 14.04
Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.
sudo apt-get update
sudo apt-get upgrade
Step 2. Install LAMP server.
A Ubuntu 14.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.
Step 3. Install CodeIgniter.
Download the latest stable version of CodeIgniter, At the moment of writing this article it is version 3.0.1:
mv /var/www/CodeIgniter-3.0.1 /var/www/codeigniter
Change the ownership of that directory and files:
chown -R www-data: /var/www/codeigniter
Step 4. Configure MySQL Database for CodeIgniter.
By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL.
Next we will need to log in to the MySQL console and create a database for CodeIgniter. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MySQL root password and hit Enter. Once you are logged in to your database server you need to create a database for the CodeIgniter software:
mysql> CREATE DATABASE codeigniter_db;
mysql> GRANT ALL PRIVILEGES on codeigniter_db.* to 'codeigniter_user'@'localhost' identified by 'YoUrPaS$w0rD';
mysql> FLUSH PRIVILEGES;
Next, you need to change the database connectivity settings to the settings needed to access your newly created database:
Find the following lines:
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
Also, you need to edit the following file:
Find the following line to set your base URL:
$config['base_url'] = 'http://yourdomain.com';
Save the file and close it.
Step 5. Configure Apache2 web server.
Edit the virtual host file and change the document root to point to /var/www/codeigniter:
Edit the following lines to match your needs:
Options Indexes FollowSymLinks MultiViews
allow from all
CustomLog /var/log/httpd/yourdomain.com-access_log common
Save and close the file once you are done. Restart the Apache service for the changes to take effect:
service apache2 restart
Step 6. Access CodeIgniter.
CodeIgniter will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com or http://server-ip and complete the required the steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.
Congratulation’s! You have successfully installed CodeIgniter. Thanks for using this tutorial for installing CodeIgniter on Ubuntu 14.04 system. For additional help or useful information, we recommend you to check the official CodeIgniter web site.