Today we are going to show you how to install CodeIgniter on Linux.. CodeIgniter is a very powerful PHP web application framework which allows developers to create full-featured web applications with ease. It is a framework with a small footprint, has a clear documentation and uses the Model-View-Controller approach to separate the presentation from logic.
Before we start, please take a look at the basic system requirements. CodeIgniter requires PHP version 5.4 or newer and MySQL 5.1 or newer with mysqli and pdo drivers so make sure that your system meets these requirements.
1. Update the System
For this tutorial, we are using an Ubuntu VPS with Ubuntu 14.04 installed. First thing we need to do is to connect to the Linux VPS via SSH and update the system software to the latest version. To update your system software, you can execute the following commands:
apt-get update apt-get upgrade
2. Download CodeIgntier
The next thing you need to do is to navigate to your server’s directory root and download the current version of CodeIgniter.
cd /var/www/ wget https://github.com/bcit-ci/CodeIgniter/archive/3.0.1.zip
3. Unzip the archive and set up directory ownership
Unzip the archive you have downloaded using the command:
Rename the directory to be more user-friendly:
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
3. Edit Apache virtual host file
Now edit the virtual host file and change the document root to point to /var/www/codeigniter.
Edit the following lines to match your needs:
<VirtualHost *:80> ServerAdmin email@example.com DocumentRoot /var/www/codeigniter/ ServerName yourdomain.com ServerAlias www.yourdomain.com <Directory /var/www/codeigniter/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/httpd/yourdomain.com-error_log CustomLog /var/log/httpd/yourdomain.com-access_log common </VirtualHost>
4. Restart Apache web server
Save and close the file once you are done. Then restart Apache by executing the command below:
service apache2 restart
5. Create new database
Now, create a MySQL database for CodeIgniter:
mysql> CREATE DATABASE codeigniter_db; mysql> GRANT ALL PRIVILEGES on codeigniter_db.* to 'codeigniter_user'@'localhost' identified by 'YoUrPaS$w0rD'; mysql> FLUSH PRIVILEGES; mysql> exit
Once you create the MySQL database you need to change the database connectivity settings to the settings needed to access your newly created database.
6. Configure database config file
Edit the following file:
Find the following lines:
$db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => '', 'password' => '', 'database' => '', );
Here, you need to enter your database connectivity settings. Save the file and close it.
Also, you need to edit the following file:
and find the following line to set your base URL:
$config['base_url'] = 'http://yourdomain.com';
Once you enter your domain name, save the file and close it.
7. Access CodeIgniter via web browser
Next thing you need to do is to open your web browser, enter your domain name in the search field and you will be able to access your CodeIgniter installation.
Further instructions about how to use this PHP web application framework you can find at:
Of course you don’t have to install CodeIgniter on Linux, if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to install CodeIgniter for you. They are available 24×7 and will take care of your request for installing CodeIgniter on Linux, immediately.
PS. If you liked this post, on how to install CodeIgniter on Linux, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.