6

whatever error occurs in Codeigniter 4 Its always showing default message Error message default from codeigniter 4

How to get exact error message in Codeigniter 4

Boominathan Elango
  • 1,156
  • 2
  • 7
  • 20

7 Answers7

16

Rename the env file as .env, then removed # from CI_ENVIRONMENT and modified

CI_ENVIRONMENT = production 

into

CI_ENVIRONMENT = development
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Boominathan Elango
  • 1,156
  • 2
  • 7
  • 20
3

Follow the following guidlines from docs

Copy or rename the env file to .env. Open it up.

Uncomment the line with CI_ENVIRONMENT on it, and change production to development

CI_ENVIRONMENT = development

and

Set the base url properly if you are not using PHP's built-in server

app/config/App.php

public $baseURL = 'http://localhost/path_to_CI/public';
Dum
  • 1,431
  • 2
  • 9
  • 23
3

Don't forget to rename :

env

to

.env

And uncomment #CI_ENVIRONMENT = development to CI_ENVIRONMENT = development

MISSIRIA
  • 392
  • 3
  • 6
3

Add this code to the index.php file at the top. Final Solution

define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
1

go to .env file in base file uncomment #CI_ENVIRONMENT = development to CI_ENVIRONMENT = development

1

There are something you need to Debug

  1. Rename the env file to .env

After Rename open the .env file. it looks like this.

enter image description here

Change this line

# CI_ENVIRONMENT = production

to

CI_ENVIRONMENT = development

After that try to create an error, then you will see error page like below.

enter image description here

Hamza Zafeer
  • 2,360
  • 13
  • 30
  • 42
0

Go to your directory project and open .env file
Change this

CI_ENVIRONMENT = production

To this

CI_ENVIRONMENT = development
Khamad Ali
  • 33
  • 1
  • 11