CodeIgniter continues to be a popular PHP framework due to its speed, simplicity, and powerful features. In 2025, setting up CodeIgniter on a local server is an efficient way to test and develop your applications before going live. This guide walks you through the installation process step-by-step.
Prerequisites
Before you proceed with the installation, ensure that your local server environment meets the following requirements:
- PHP Version: PHP 8.0 or later
- Database: MySQL (or compatible)
- Server: Apache or Nginx
- Composer: Installed globally
- CodeIgniter Version: Latest stable version
Step-by-Step Installation Guide
Step 1: Setting Up Your Local Server
If you haven't already set up a local server, you can use packages like XAMPP, WAMP, or MAMP. These come with Apache, MySQL, and PHP pre-installed.
-
Download and Install:
- Go to the respective website of your preferred local server package.
- Follow the installation instructions provided on their site.
- Start the Apache and MySQL services.
Step 2: Download CodeIgniter
Visit the CodeIgniter official download page and download the latest version.
Alternatively, you can use Composer to create a new project:
composer create-project codeigniter4/appstarter my-project
Step 3: Configuring Your Environment
Once downloaded and extracted, navigate to the project directory.
-
Rename the
.env.example
file to.env
:
mv env.example .env
-
Set the Base URL:
- Open the
.env
file and set theapp.baseURL
tohttp://localhost/my-project/
.
- Open the
Step 4: Database Configuration
Open app/Config/Database.php
and configure your database settings:
public $default = [
'DSN' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'your_database_name',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'production'),
'cacheOn' => false,
'cacheDir' => '',
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
];
Step 5: Running CodeIgniter
Open your browser and navigate to http://localhost/my-project/
. If everything is set up correctly, you'll see the CodeIgniter welcome screen.
Further Configuration
Redirect Protocols
To secure your application by redirecting HTTP to HTTPS in CodeIgniter, you can read this guide.
URL Management
For customization of CodeIgniter URLs using .htaccess
, follow this tutorial.
URL Redirection
Learn how to redirect pages within CodeIgniter by visiting this page.
DateTime Formatting
Understand how to set DateTime formats in CodeIgniter forms by reviewing this article.
Managing Arrays
To learn how you can create new arrays from multiple arrays in CodeIgniter, check this resource.
By following these steps, you should have a fully functional CodeIgniter setup on your local server. This setup will enable you to develop efficient web applications with quick testing capabilities. Happy coding!
Top comments (0)