CodeIgniter 4.3.1 setup or installation without composer. Here we will see the complete setup of CodeIgniter 4 in localhost or hosting server without using composer.
STEP 1:
Download CodeIgniter 4 from the official site.
Extract the zip on your root folder and you will get a folder structure like given below:
STEP 2:
Copy ‘index.php‘ and ‘.htaccess‘ from ‘public’ folder to root folder.
STEP 3:
Open ‘index.php‘ from root folder and change
require FCPATH . ‘../app/Config/Paths.php’;
to
require FCPATH . ‘/app/Config/Paths.php’;
(Just remove ‘..’ before app/)
STEP 4:
Open app/Config/App.php and set your baseURL
e.g. public string $baseURL = ‘http://localhost/ci4/’;
STEP 5:
Create .env file and paste from env file.
STEP 6:
Open .env file and set CI_ENVIRONMENT from production to development and remove # to enable. e.g.
# CI_ENVIRONMENT = production
to
CI_ENVIRONMENT = development
STEP 7:
- open .htaccess file from root folder
- Paste below code on top of .htaccess page.12345RewriteEngine OnRewriteCond %{HTTPS} !=onRewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC]RewriteRule ^ %1 [L,NE,R=302]RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
Setup is ready on localhost, same folder will run on hosting server but you have to change base url in app/Config/App.php as given in STEP 4.