CodeIgniter 4 – Switching between Development and Production mode

Learn how to switch between production and development environment mode in CodeIgniter 4.

By default, CodeIgniter starts up in production mode. When production mode is enabled, CodeIgniter will not show detailed errors in browser in case
your application is broken when running in a live server. This will keep your application a bit more secure.

But this mode should be switched to development mode when you want to run the application in your development machine. This will help you easily to investigate and fix bugs.

Here are steps to switch your CodeIgniter application from production mode to development mode:

Step 1. At root project directory, copy or rename the env to .env file

Step 2. Open .env file, uncomment CI_ENVIRONMENT variable and change its value from production to development as described below

change from:

# CI_ENVIRONMENT = production


CI_ENVIRONMENT = development

That’s all. Let us know if it works for you by adding a comment in below form. Thank you for reading the post.

0 0 vote
Article Rating
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x