mysql settings in settings.dat

3 posts by 3 authors in: Forums > CMS Builder
Last Post: August 18, 2010   (RSS)

By rjbathgate - August 17, 2010 - edited: August 17, 2010

Hey,

The mysql settings in settings.dat.php:

[mysql]
hostname = "xxxxx"
database = "xxxx"
username = "xxxxx"
password = "xxxxxx"
tablePrefix = "cms_"
allowSystemFieldEditing = 1
textOnlyErrors = 0


Is there a way I can have two instances based on server, i.e.:


[mysql]
hostname = "someserver"
database = "xxxx"
username = "xxxxx"
password = "xxxxxx"
tablePrefix = "cms_"
allowSystemFieldEditing = 1
textOnlyErrors = 0


[mysql IF LOCALHOST]
hostname = "localhost"
database = "xxxx"
username = "xxxxx"
password = "xxxxxx"
tablePrefix = "cms_"
allowSystemFieldEditing = 1
textOnlyErrors = 0


I.e. so i can have settings for cmsb when it's on http://localhost and different for when on http://server

Thanks!

Re: [rjbathgate] mysql settings in settings.dat

By Dave - August 18, 2010

Hi Rob,

There should be a file in /data/ called /data/how_to_use_settings_files.txt which explains how to do that. Here's the contents:


HOW TO USE MULTIPLE SETTINGS FILES
-------------------------------------

If you run CMS Builder on both a development and a live server, you can create a
copy of settings.dat.php for your development environment by naming it after
your development host (typically localhost).

For example, if you create a copy called settings.localhost.php, CMS Builder
will use that file when it's running on localhost, but default to
settings.dat.php when it runs anywhere else.

This functionality is especially useful for supplying separate MySQL details.
Once you have this set up, you won't have to worry about overwriting the "wrong
version" of a settings file; you can safely upload and download both files with
FTP and the correct one will be used on each server.

Note: Only ever use custom settings files for development servers, always use
the default file for your "live" or production server. That way if you live
domain name changes things won't break.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com