In yii’s application template, there are these two sentences in front of index.php
<?php // comment out the following two lines when deployed to production defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev');
When deploying to production, comment out the following two lines, the comment above says this.
But anyone who has experienced team development and deployment environments knows that this means that a manual operation is required during deployment. If the operator does not know or forgets this operation, it will be a tragedy.
So why are there these two sentences? Or is there any way to avoid tragedy?
The answer is the auto_prepend_file configuration item in php.ini. In different server environments such as production, testing, etc., define an auto_prepend_file php script, which defines these two constants:
<?php define('YII_DEBUG', false); define('YII_ENV', 'prod');
This script can be pre-defined in the server image. When opening a new machine, directly use this php environment containing the auto_prepend_file script. In the subsequent schedule maintenance, tragedies will not occur.
The above is why the editor introduces to you why there are these two sentences in the yii entry file index.php. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. . I would also like to thank everyone for your support of the Script House website!