Page MenuHomePhabricator

Get MW_CONFIG_FILE from env to facilitate virtual hosting
Open, LowPublic


includes/WebStart.php allows for the possibility that MW_CONFIG_FILE has already been defined externally, but there is no mechanism in the code to facilitate it being predefined. My suggestion/request is to check the environment, see if a variable with such name is defined there, and if so pull its value in just as is already done with IP earlier in the same file.

The advantage of this feature would be that a virtual hosting web server could use the same MW code base to serve multiple different wikis simply by configuring this env var to point to the appropriate LocalSettings.php for each one.

Current workaround: In Apache, for each wiki I set:

SetEnv MW_CONFIG_FILE Path_to_this_wikis_LocalSettings.php
php_admin_value auto_prepend_file getMW_CONFIG_FILE_from_Env.php

Where getMW_CONFIG_FILE_from_Env.php contains just the one line:

define('MW_CONFIG_FILE', getenv( 'MW_CONFIG_FILE' ));

The present request would make only the one SetEnv customization line necessary for each host. I consider this to be a cleaner solution, at least for some situations, than other current options such as