Welcome Guest, Not a member yet? Register   Sign In
Whats the benefit of using a config.php on different environments?
#1

Hi guys,

Im reading the codeigniter 2 cookbook.

Quote:In some cases, it may be useful to adapt your configuration files so that they can function on several servers or environments without having to edit or maintain each time they are moved. For example, the configuration settings you may have on your localhost are very likely to be different than those on a live or production server. Setting the configuration files correctly will save you a lot of time rather than manually switching between the two.
I read the same method also for database settings..!

So my question is why someone should use this method for few projects?
Reply
#2

The answer is within the text that you've quoted ...

Quote:In some cases, it may be useful to adapt your configuration files so that they can function on several servers or environments without having to edit or maintain each time they are moved. For example, the configuration settings you may have on your localhost are very likely to be different than those on a live or production server. Setting the configuration files correctly will save you a lot of time rather than manually switching between the two.
Reply
#3

Let me know if I'm mistake, thats only for my usage between localhost and live version not for using project1 and project2, am i right?
Also i asked about why we need to do that for DataBase as well? we can have a same database on our live host and localhost, correct?

First i though its for this usage: Put config.php on Server1 and set the setting for project1 & 2 (with their own server) and then point them to read from Server1 for project1 Or 2.
Reply
#4

(02-11-2015, 05:22 AM)ardavan Wrote: Let me know if I'm mistake, thats only for my usage between localhost and live version not for using project1 and project2, am i right?

Correct.

(02-11-2015, 05:22 AM)ardavan Wrote: Also i asked about why we need to do that for DataBase as well? we can have a same database on our live host and localhost, correct?

It is certainly possible, but shouldn't ever be the case. A development environment shouldn't use the production database.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB