For example database connection / email parameters.
In the config file how to determine if the app is on localhost or on the live server?
For example database connection / email parameters.
In the config file how to determine if the app is on localhost or on the live server?
Cheers Mike.
Ideally I want to automate everything, i.e. I don’t want to keep modifying variables or using different entry scripts. So what I’ve done is created two mini-config files - dev.php and live.php
I’ve then added the following to my index.php entry script:
if($_SERVER['HTTP_HOST']=='localhost')
$config=dirname(__FILE__).'/protected/config/dev.php';
else
$config=dirname(__FILE__).'/protected/config/live.php';
I don’t know whether this is the most elegant way of doing this - any suggestions would be welcome.
I think it’s perfectly fine. Things like this depend very much on your specific setup so there’s not really a general solution.