Setting up a Codeigniter project
- Go to
directoryC:\xampp\htdocs - Right click and open in terminal or open command line interface
- Run
composer create-project codeigniter4/appstarter bookshop - Go to
open in text editor (with admin rights)C:\Windows\System32\drivers\etc\hosts - Add
and save127.0.0.1 bookshop.local - Go to
open in text editor (with admin rights)C:\xampp\apache\conf\extras\httpd-vhosts.conf - Add
Or<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/bookshop" ServerName bookshop.local <Directory "C:/xampp/htdocs/bookshop"> Require all granted AllowOverride All </Directory> </VirtualHost><VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/bookshop/public" ServerName bookshop.local </VirtualHost> - Restart Xampp if needed
- If you are using Xampp first time,
- Open Xampp Control Panel
- Click config next to Apache
- Open php.ini
- Sometime there is no specific php.ini instead two files are there php.ini-prouduction and php.ini-development
- Go to file explorer and open in view tab > show > file name extensions
- Change the extension of php.ini-development to php.ini.
- The it'll show with colors in an IDE
- Remove semicolon from
;extension=zipand;extension=intl - Save the file
- Go to project folder
C:\xampp\htdocs\bookshop - Open
envfile - Change
productiontodevelopment# ENVIRONMENT #-------------------------------------------------------------------- CI_ENVIRONMENT = development - Change base url
app.baseURL = 'http://bookshop.local/' - Save and close the file. Then rename it as
.env -
Remove Public and index.php from URL
- Open App.php File from the Location c:\xampp\htdocs\bookshop\app\Config\App.php
- Change from
topublic @baseURL = 'http://localhost:8080';public @baseURL = 'http://bookshop.local'; - Change from
topublic $uriProtocol = 'REQUEST_URI';public $uriProtocol = 'PATH_INFO'; - In public directory, move
index.phpand.htaccessfile to the root project folder. - Open index.php from project root directory, and edit the following path: from
to$pathsPath = FCPATH.'../app/Config/Paths.php';$pathsPath = FCPATH.'app/Config/Paths.php';