Welcome Guest, Not a member yet? Register   Sign In
Multiple Environment Setup Help
#2

[eluser]dejan[/eluser]
Well, there is an obvious way for all PHP files:

if ($_SERVER['SERVER_NAME'] === 'www.production.com') {
$config['param'] = 'value';
} elseif ($_SERVER['SERVER_NAME'] === 'local.development') {
$config['param'] = 'value';
}

There is also a way to "override" config items, which may be cleaner. Add something like this to index.php:

$assign_to_config['name_of_config_item'] = 'value of config item';

You can obviously keep these in a separate file and do something like:

if ($_SERVER['SERVER_NAME'] === 'www.production.com') {
include_once('production_overrides.php');
}

and keep the $assign_to_config array in that override.

As far as .htaccess goes, it has a condition like:
RewriteCond %{SERVER_NAME} = www.production.com

But I'm personally a lighttpd man, so I don't know all the details Smile


Messages In This Thread
Multiple Environment Setup Help - by El Forum - 08-16-2012, 05:53 AM
Multiple Environment Setup Help - by El Forum - 08-16-2012, 08:03 AM
Multiple Environment Setup Help - by El Forum - 08-16-2012, 02:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB