Javatpoint Logo
Javatpoint Logo

Yii Entry Scripts

It is the first step in application handling process and responsible to start a request handling cycle. An application has a single entry script. Request made by end users comes to entry script which initialize the application and forward the request to them.

These scripts are stored under web application directories to make them accessible by the end users. By default, they are named as index.php but can also be given other names.

For a console application, entry scripts are stored in base path and named as yii.php. They should be made executable for users to run on console application.

Entry scripts perform following work:

  • Define global constants
  • Register Composer autoloader
  • Include Yii class file
  • Load application configuration
  • Create and configure an application instance
  • Call the application to process the request

Defining Constants

Global constants are very well defined in the entry scripts. They should be defined at the beginning of an entry script for effective result when other PHP files are included. Yii framework supports following three constants:

  • YII_DEBUG: It specifies whether an application is running in debug mode or not. This mode should be mainly used during development. Because an application will keep more log information and will reveal detailed error if in debug mode.
  • YII_ENV: It defines the environment the application is running in. Its default value is 'prod' which stands for 'Production'. Other values are dev and test.
  • YII_ENABLE_ERROR_HANDLER: By default it is always true. It specifies whether to enable or disable the error handler value.
Next TopicYii Models




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA