When we work with any application, always work in development mode means first start your debug mode. It’s because while application compiles, you will get the error if your code will have.
When we install CodeIgniter 4, we have env file at root. To use the environment variables means using variables at global scope we need to do env to .env
Open project in terminal
cp env .env
Above command will create a copy of env file to .env file. Now we are ready to use environment variables.
Turn Development Mode
By default you will see in .env file –
CI_ENVIRONMENT = production
Environment is in production. So in this case, you will not be able to see errors when you get.
Do it to –
CI_ENVIRONMENT = development
Now application is in development mode.