Skip to content

Instantly share code, notes, and snippets.

@akuzemchak
Last active May 30, 2016 23:53
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save akuzemchak/d27570a3e52bdf656f54 to your computer and use it in GitHub Desktop.
Save akuzemchak/d27570a3e52bdf656f54 to your computer and use it in GitHub Desktop.
Use FocusLab Config with MSM
  1. In your main site's index.php file (and also your admin.php and system/index.php files), add the following lines just below the custom config values section:

    define('FLC_DOCROOT', $_SERVER['DOCUMENT_ROOT']);
    define('FLC_PATH', $_SERVER['DOCUMENT_ROOT'].'/config');
  2. In config.master.php, update the lines 94 and 235 as follows:

    $base_path = FLC_DOCROOT;
    
    require FLC_PATH . '/config.' . ENV . '.php';
  3. In system/expressionengine/config/config.php and system/expressionengine/config/database.php, change the require lines as follows:

    require FLC_PATH . '/config.master.php';
  4. In each of your MSM sites' index.php files, add the lines from #1 above, but make sure to change FLC_PATH to your main site's config folder.

@cottonhen
Copy link

Hi there! I've done as you suggest but now when I go to the CP www.mysite.com/admin.php i get an error beacesue the costants are not defined (FLC_DOCROOT and FLC_PATH are defined in index.php) any idea?

@akuzemchak
Copy link
Author

Sorry, never saw this comment. Just updated the gist to say that the lines in step 1 need to also be defined in admin.php and system/index.php.

@jdaining
Copy link

Thanks for this!

@Jameswilsonjennings
Copy link

Hi, thanks for this! working fine for the main site. With point (4), can you give an example, do you mean the master config folder or the ee config folder. I've tried just hardcoding both like:
define('FLC_PATH', '/var/www/vhosts/mainsite.com/httpdocs/config'); But no child msm site loads.

Regards,

James.

@nachopants
Copy link

nachopants commented May 30, 2016

Hi guys,

I've set this up (v3.3.2) but seem to be getting a bizarre issue.

Fatal error: Cannot redeclare class EE_Benchmark in /var/www/html/www.heffron-it.com.au/system/ee/legacy/core/Benchmark.php on line 30

Has anyone else run into this, or does this solution no longer work?

EDIT [SOLVED]

$env_config['subclass_prefix'] = 'EE_'; is required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment