Tip: Because PostController already declares index to be its default action, when we access the home page of the application, we will see the result generated by the index action of the post controller.

Because ActiveRecord relies on the metadata about tables to determine the column information, it takes time to read the metadata and analyze it. This may not be a problem during development stage, but for an application running in production mode, it is a total waste of time if the database schema does not change. Therefore, we should enable the schema caching by modifying the application configuration as follows,

In the above, we first add a cache component which uses a default SQLite database as the caching storage. If our server is equipped with other caching extensions, such as APC, we could change to use them as well. We also modify the db component by setting its schemaCachingDuration property to be 3600, which means the parsed database schema data can remain valid in cache for 3600 seconds.

We modify the entry script file /wwwroot/blog/index.php by removing the line defining the constant YII_DEBUG. This constant is useful during development stage because it allows Yii to display more debugging information when an error occurs. However, when the application is running in production mode, displaying debugging information is not a good idea because it may contain sensitive information such as where the script file is located, and the content in the file, etc.