N
N
NatanNovak2015-01-08 21:28:30
Yii
NatanNovak, 2015-01-08 21:28:30

Yii2. Correct division of configurations into main and main-local?

Hello. Installed Yii 2 with Adv template. I ask about the basis, conf. files: main and main-local - as I understand it, the system itself determines whether it is located locally or on the server or not? I uploaded it to the server and still the data is loaded from main-local. Please decipher for me this subtle moment with configs and deployment.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Terminaft, 2015-01-08
@Terminaft

The main-local config on your server and on your local should be different. For example, database connection parameters are stored there. It is logical that on the server and on the local they will be different. And so that each time before the deployment you do not manually change these parameters, you from the very beginning upload main-local to the server and keep it there, and use yours on the local. It makes deployment much easier, you know;)
PS The system itself does not determine where it is located, the maximum you can set is the dev environment (YII_ENV_TEST) during the initial installation of the framework

A
Anatoly Gusev, 2015-01-10
@MximuS

The system itself, as you were told, does not determine anything, I personally wrote a small code for myself in the index.php file, which determined the domain where it is located and automatically loaded the necessary config.

N
NatanNovak, 2015-01-10
@NatanNovak

I did the same in version Yii 1.1 - I wrote a localhost check in the index and loaded the necessary config. I looked at Yii with already separated configs and thought... maybe everyone has already written for me! But no :) Thanks guys for the tips!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question