Home > Article > Backend Development > Why are there two sentences in Yii’s entry file index.php?
This article mainly introduces why there are these two sentences in yii's entry file index.php. Friends who need it can refer to the first part of index.php in
yii's application template. There will be these two sentences
<?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 deployed to the production environment, comment out the following two lines, the above comment 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 of 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 for subsequent schedule maintenance. , there will be no more tragedies.
The above is the detailed content of Why are there two sentences in Yii’s entry file index.php?. For more information, please follow other related articles on the PHP Chinese website!