How to setup Codeigniter4 on CentOS

The basic requirement for CodeIgniter4 is to have php version 7.2 or higher.
The manual installation is straight forward on a CentOS system.

Step 1 : Download the framework zip from https://codeigniter4.github.io/userguide/installation/installing_manual.html
Extract the installation to /var/www/html/newproject folder.

When you see the files under newproject folder you should be able to see the below structure.

Step 2 : Modify the httpd configuration file at /etc/httpd/conf/httpd.conf.
Set the DocumentRoot “/var/www/html/newproject/public”

Step 3 : Now restart the httpd service with the command

service httpd restart 

Open browser and type localhost.
You should be able to see the welcome screen for Codeigniter4.

Alternatively you can create a virtual host entry on CentOS.

Open file at /etc/hosts

And you can do an entry with the localhost IP

eg. You can add the below line and save the file.
127.0.0.1 local.dvxlab.com

Now instead of localhost you can type the url local.dvxlab.com and it will open the same welcome page.

Leave a Reply