Best way to define separate config variables for localhost and 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:





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.