Is it possible with Drupal to have two sites, with 2 separate databases, sharing the same PHP code?
For the future need of porting one database to another server, I don't want to use "Multi Site Installation".
Yes, you can run several independent Drupal sites off the same codebase. Some instructions are here: https://www.drupal.org/documentation/install/multi-site
Basically, each has its own database and its own sites/yoursite.org
folder where the settings files and site-specific files go. All use the sites/all
folder. When you visit via http://yoursite.org, Drupal checks the sites/yoursite.org
folder for a settings.php file, and if there is no sites/yoursite.org
folter, it uses sites/default
. (There's a more nuanced pecking order of folders, but this is the gist.)
For CiviCRM, it works the same: you put civicrm.settings.php in sites/yoursite.org
, and the module lives in sites/all/modules
. Your database is independent of the other sites; the only thing shared is the module code.
However, there is a reason why many people don't set up their sites this way: there's not much benefit to having a single copy of the modules (the files aren't that big), but you can do things on one site that inadvertently cause problems on one of the others. As an example, if you upgrade one site's CiviCRM, you're replacing the files used by all of your sites, requiring you to run the upgrade script on all of them.
sites/yoursite.org
, so they'll be site-specific.
Commented
Apr 26, 2016 at 13:29
/etc/hosts
, but something else for you on Windows) to point fake domains to 127.0.0.1. If you have one entry reading 127.0.0.1 onesite.dev
and the other reading 127.0.0.1 othersite.dev
, you'll put settings files at sites/onesite.dev/settings.php
and sites/othersite.dev/settings.php
. You may need to configure Apache to serve the folder from those virtual domains.
Commented
Jun 9, 2016 at 17:03