Home > Backend Development > PHP Tutorial > Why are there these two sentences in Yii's entry file index.php_php examples

Why are there these two sentences in Yii's entry file index.php_php examples

WBOY
Release: 2016-08-17 13:02:30
Original
976 people have browsed it

In yii’s application template, there are these two sentences in front of index.php

<&#63;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'); 
Copy after login

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:

<&#63;php
define('YII_DEBUG', false);
define('YII_ENV', 'prod'); 
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template