Codeigniter tutorial Part-1 -How to start project in CodeIgniter 4?

How to start project in CodeIgniter 4?

CodeIgniter is an open-source software rapid development web framework, for use in building dynamic web sites with PHP.

CodeIgniter is a PHP MVC framework used for developing web applications rapidly. CodeIgniter provides out of the box libraries for connecting to the database and performing various operations like sending emails, uploading files, managing sessions, etc.

Step 1:

Download Codeigniter latest Version v4.0.4

https://www.codeigniter.com/        

 

Step 2:

Extract downloaded .zip file.

If you are using XAMPP server copy and paste extracted file inside htdocs directory

C:\xampp\htdocs\

 

Step 3:

Rename folder as your project name.

For example my project name is ci_tutorial.

C:\xampp\htdocs\ci_tutorial

 

Step 4:

Now start your xampp server and run your project using chrome

http://localhost/ci_tutorial/public/

Sometime it shows error like this

But don’t worry, go to C:\xampp\htdocs\ci_tutorial\system and open Codeigniter.php in text editor.

And replace

	
	locale_set_default($this->config->defaultLocale ?? 'en');
	

with


	if (function_exists('locale_set_default')) {
		locale_set_default($this->config->defaultLocale ?? 'en');
	}

Now reload page.

 

Step 5:

Now your project is ready, if you want  remove public and directly run your project without /public,

Cut index.php file from  /public and paste it in your root folder and edit this


	$pathsPath = realpath(FCPATH . '../app/Config/Paths.php');

To

	
		$pathsPath = realpath(FCPATH . 'app/Config/Paths.php');
	

Now you can run your project without segment /public.

http://localhost/ci_tutorial/

Leave a reply