How is setting YII_DEBUG different from setting YII_ENV_DEV?

How is setting YII_DEBUG to true different from setting YII_ENV_DEV to true (or YII_ENV to ‘dev’)? What does enabling YII_DEBUG do which enabling YII_ENV_DEV doesn’t, and what does enabling YII_ENV_DEV do which enabling YII_DEBUG doesn’t? And what difference does setting YII_ENV to ‘dev’ instead of ‘prod’ make ?

Hi @hongKIlDon

You can read the descriptions of those constants in the following section of the guide.

Guide > Application Structure > Entry Script > Defining Constants.

And in Guide > Key Concepts > Configurations > Environment Constants

In short:

  1. YII_DEBUG … Yii will run in the debug mode and more detailed error information will be logged. This happens in the framework level.
  2. YII_ENV_DEV … It says that you are in the development environment. But It’s all up to you what you do with it. But usually you may want to enable “debug” and “gii” modules. That’s what “app-basic” and “app-advanced” templates do for you. And probably you may want to use a different db configuration for the development environment.