Before reading CodeIgniter in local development server blog post, read this post.
A local development server is a server hosted on your computer. Setting up local server enables developer to setup project and work on it without any network configurations. CodeIgniter can be run in local development server.
Live websites are hosted on remote server which requires money to host a live website. During development web developers has to make frequent changes which may affect live websites.
Website visitor may get furious on frequent changes on live server. So it is better to perform changes on local development server and push changes to remote server when required functionality is achieved.
One of the advantages of web developers is the ability to work remotely. If we have laptop or PC and have access to internet, web development can be carried out being on remote location.
Reasons behind setting up local development servers are:-
- Working on local development server ensures viewer access is limited to web developer only.
- Only selected people can view on website that is under construction on local server who are on local area network (LAN).
- With local development server, web developer can work independently of internet which makes web development faster as it removes idle time due to low strength of internet connection.
- Web developer doesn’t have to buy web hosting account which decreases initial investment and local development server is free of cost.
- Web developer can experiment with different designing and development process to test out new ideas, designs and concept.
CodeIgniter in Local Development Server
XAMPP is completely free, easy to install apache distribution containing MariaDB, PHP, and perl. It is open source package has been setup to be incredibly easy to install and use.
It is available for all platform Windows, Linux and MAC OS. It can be downloaded from this site.
Download your XAMPP
I’ve 64-bit architecture Windows OS on my PC so I’ll be using XAMPP for windows. You can download as of your operating system. (Don’t forget to check your system architecture)
After download is complete, run XAMPP as administrator.
During installation it will ask you to choose components to install; leave as it is and click next button.
Installation directory, language can be changed as desired. On next button click installation is complete.
After installation, open the XAMPP control panel. Click on start Apache and MySQL.
If you don’t see red text (error), you are lucky (see above screenshot) else you will generally run into following error.
Above picture shows that 80 port is not empty i.e. some services has been bind on 80 ports. 80 port is listening for request from a certain service.
Above problem can be solved by changing Apache service listening port.
For this click config button of Apache Module and go to Apache (httpd.conf)
Go to Listen 80 and changed it to any desired port (some port are reserved for services search it on google for reserved port). I’ve changed it for 81 port and save it.
After changing setting in httpd.conf file, apache module will be working.
If 80 port (http) is not bind with any services localhost can be accessed with http://localhost
else it should be accessed with custom port number as http://localhost:port_num.
In this tutorial we will use 81 port as I’ve setup for 81 port listening request. So localhost is available at http://localhost:81
I’ll use this setting for upcoming post.
PHP recommended version is 5.6 or newer. However is can work on 5.3.7 as well. I suggest you all to install newer version of PHP as potential security and performance issues are updated and missing features are added.
Currently supported database are
- MySQL via mysql, mysqli and pdo drivers
- Oracle via 0ci8 and pdo drivers
- MS SQL via the mssql, sqlsrv and pdo drivers
- Postgre SQL via postgre and pdo drivers
- ODBC via odbc and pdo drivers
- SQLite via sqlite, sqlite3, and pdo drivers
- and so one
CodeIgniter Download and Installation
Here CodeIgniter provides CodeIgniter 2, CodeIgniter 3 and CodeIgniter 4 for download.
CodeIgniter 2 is legacy version of the framework, CodeIgniter 3 is current version of the framework and supported by PHP 5.6 + and CodeIgniter 4 is upcoming version of the framework intended for PHP 7.2+
For this tutorial series I’ll use CodeIgniter 3. Click on download button under CodeIgniter 3
It will be downloaded on .zip file. Extract it to desired directory location.
You will see above files in that directory. Copy all files and go to your XAMPP installed location. Inside htdocs directory add a folder with your desired domain name and paste there.
I’ve created folder name dokocrunch and all files were copied there.
I can access my new web development site on http://localhost:81/dokocrunch
CodeIgniter is successfully installed in Local Development Server.
Thank you for reading post top to bottom. I’ve tried my best to setup local development server.
Please! Comment down what you think about this post. It will be my motivation and tips to improve in my next blog post.