whatever error occurs in Codeigniter 4 Its always showing default message
How to get exact error message in Codeigniter 4

- 1,156
- 2
- 7
- 20
-
put `error_reporting(E_ALL);` in the constructor. – BEingprabhU Mar 03 '20 at 07:18
-
tried @BeingprabhU Nothing happen – Boominathan Elango Mar 03 '20 at 07:34
-
put that inside the function where you are facing issue – BEingprabhU Mar 03 '20 at 07:36
-
even put inside also not works anyother way ? – Boominathan Elango Mar 03 '20 at 07:39
-
1How about this `ini_set('display_errors', 1);`?? – BEingprabhU Mar 03 '20 at 07:41
-
Did that work?? – BEingprabhU Mar 03 '20 at 07:43
-
No its not works!! – Boominathan Elango Mar 03 '20 at 07:44
-
@elango, please refer to https://codeigniter4.github.io/userguide/general/logging.html for error logging. I'm not sure why the other solutions didn't work for you – BEingprabhU Mar 03 '20 at 07:53
7 Answers
Rename the env
file as .env
, then removed # from CI_ENVIRONMENT and modified
CI_ENVIRONMENT = production
into
CI_ENVIRONMENT = development

- 1,048,767
- 296
- 4,058
- 3,343

- 1,156
- 2
- 7
- 20
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 changeproduction
todevelopment
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';

- 1,431
- 2
- 9
- 23
Don't forget to rename :
env
to
.env
And uncomment #CI_ENVIRONMENT = development to CI_ENVIRONMENT = development

- 392
- 3
- 6
Add this code to the index.php file at the top. Final Solution
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');

- 154
- 1
- 7
go to .env file in base file uncomment #CI_ENVIRONMENT = development to CI_ENVIRONMENT = development

- 97
- 1
- 8
There are something you need to Debug
- Rename the
env
file to.env
After Rename open the .env
file. it looks like this.
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.

- 2,360
- 13
- 30
- 42
Go to your directory project and open .env file
Change this
CI_ENVIRONMENT = production
To this
CI_ENVIRONMENT = development

- 33
- 1
- 11