FedoraRHEL Based

How To Install CodeIgniter on Fedora 38

Install CodeIgniter on Fedora 38

In this tutorial, we will show you how to install CodeIgniter on Fedora 38. CodeIgniter, a robust PHP framework, has garnered immense popularity among web developers for its simplicity, efficiency, and flexibility. While automated installation methods exist, this comprehensive guide will walk you through the process of manually installing CodeIgniter on Fedora 38 using the command line interface (CLI).

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 and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of CodeIgniter on a Fedora 38.


  • A server running one of the following operating systems: Fedora 38.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A stable internet connection is crucial as we’ll be downloading and installing various packages and dependencies from remote repositories.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install CodeIgniter on Fedora 38

Step 1. Before we can install CodeIgniter on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install CodeIgniter without any issues:

sudo dnf update

Step 2. PHP Installation and Configuration.

CodeIgniter typically requires PHP 7 or higher. Ensure that PHP is installed and correctly configured on your Fedora 38 system. You can check your PHP version by running the following command:

php -v

If PHP is not installed, you can install it using the following command:

sudo dnf install php php-cli php-zip

Step 3. Composer Installation.

Composer, the PHP package manager, is essential for managing CodeIgniter’s dependencies efficiently. Install Composer on your system with the following commands:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer

Step 4. Installing CodeIgniter on Fedora 38.

Navigate to your desired project directory and use wget to download the latest version of CodeIgniter from the official GitHub repository. Replace [version] with the latest version number:

wget https://github.com/codeigniter4/CodeIgniter4/archive/refs/tags/v4.4.1.zip

Once the download is complete, unzip the downloaded ZIP file:

unzip v4.4.1.zip

After unzipping, you’ll have a directory named framework-4.x, which contains the CodeIgniter files. Move these files to your web server’s document root or a directory accessible by the web server:

sudo mv framework-4.x /var/www/html/your_project_folder

Step 5. Configuration Apache.

A web server, such as Apache or Nginx, should be installed and properly configured to serve your CodeIgniter application. If not already installed, now install the Apache web server using the following command below:

sudo dnf install apache

Next, create a virtual host configuration file in the /etc/httpd/conf.d/ directory. Replace [your_project_folder] with the actual path to your project directory:

sudo nano /etc/httpd/conf.d/codeigniter.conf

Add the following configuration:

<VirtualHost *:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/www/html/codeigniter/public
ServerName yourdomain.com

<Directory /var/www/html/codeigniter/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

ErrorLog /var/log/httpd/codeigniter_error.log
CustomLog /var/log/httpd/codeigniter_access.log combined

By configuring the webserver to point to CodeIgniter’s public folder, you ensure that only files in this directory are accessible via the web browser, enhancing security. Restart Apache to apply the changes:

sudo a2ensite codeigniter.conf
sudo systemctl restart httpd

Step 6. Database Setup.

If not already installed, install a database server such as MySQL, MariaDB, or PostgreSQL. For this guide, we’ll use MySQL:

sudo dnf install mysql-server

Start the MySQL service and enable it to start on boot:

sudo systemctl start mysqld
sudo systemctl enable mysqld

Access the MySQL command line as the root user and create a new database for your CodeIgniter application. Replace [database_name] with your desired database name:

mysql -u root -p
CREATE DATABASE [database_name];

Navigate to your CodeIgniter project’s root directory and edit the .env file to configure the database connection. Replace [database_name], [database_user], and [database_password] with your database credentials:

nano .env

In the .env file, set the database configuration according to your MySQL credentials:

database.default.hostname = localhost
database.default.database = [database_name]
database.default.username = [database_user]
database.default.password = [database_password]

Step 7. Composer Dependencies.

Navigate to your CodeIgniter project directory using the terminal and run the following command to install CodeIgniter’s required dependencies:

composer install

Composer will fetch and install all the necessary packages for your CodeIgniter application.

After installing dependencies, update the Composer autoload file to ensure that CodeIgniter’s classes are properly loaded:

composer dump-autoload

Step 8. Environment Configuration.

CodeIgniter allows you to configure environment-specific variables in the .env file. This is particularly useful for managing different configurations for development, production, and testing environments.

Edit the .env file to customize configuration settings based on your development environment:

nano .env

Customize the environment variables to fit your specific needs, such as database settings and application environment:

# Development
CI_ENVIRONMENT = development
app.baseURL = 'http://localhost/your_project_folder/public/'

# Production
# Uncomment and configure these lines for your production environment
# CI_ENVIRONMENT = production
# app.baseURL = 'https://your-domain.com/'

Step 9. Security Enhancements.

For security reasons, it’s essential to disable directory listing. Open your virtual host configuration file (e.g., codeigniter.conf for Apache) and add the following line within the <Directory> block:

Options -Indexes

Save the file and restart Apache:

sudo systemctl restart httpd

Ensure that file permissions are correctly set to restrict unauthorized access to sensitive files. Navigate to your project’s root directory and run:

sudo chown -R apache:apache /var/www/html/codeigniter
sudo chmod -R 755 /var/www/html/codeigniter

Step 9. Test Your Application.

To verify that your CodeIgniter installation is successful, create a basic controller and view. Use the terminal to generate a new controller named “Welcome”:

php spark make:controller Welcome

This command will create a new controller file named Welcome.php in the app/Controllers directory. Add a simple method to this controller:

public function index()
echo "Welcome to CodeIgniter!";

Open your web browser and access your CodeIgniter application by entering the URL:


You should see the message, “Welcome to CodeIgniter!” displayed in your browser, confirming that your installation is successful.

Congratulations! You have successfully installed CodeIgniter. Thanks for using this tutorial for installing CodeIgniter on your Webmin 38 system. For additional help or useful information, we recommend you check the official CodeIgniter website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button