2

I am very confused with the evolution of Drupal 8 going away from its ability in Drupal 7 to easily handle multisite.

Is it still possible to share a Civi database with the multisite extension with several Drupal 8 sites?

What about sharing a CiviCRM database between a mix of Drupal 7 and Drupal 8 sites?

More globally, can a Civi database be separated from the Drupal 8 database ?

========= I had read from David Snopek while researching this question that he thought it might work to use an edited version of the file civicrm.settings.php, though hadn't actually tried because of his server policies.

So I tried integrating an additional Drupal 8 site already running with a Drupal 7 site! I edited the civicrm.settings.php in Drupal 7 site in order to adapt it to the path of the Drupal 8 site as follows:

$civicrm_root = '/PATH/SITE/public_html/sites/all/modules/civicrm';

became this :

$civicrm_root = '/PATH/SITE/public_html/vendor/civicrm/civicrm-core';

But I this error message was the result:

PHP Fatal error:  Call to undefined function variable_get() in /var/data/sites/reveal/public_html/vendor/civicrm/civicrm-core/CRM/Utils/System/Drupal.php on line 790and –-
3

I was able to separate my Drupal 8 database from my CiviCRM database fairly easily, here are my notes I took on how to do it. Note that these steps aren't particularly specific to Drupal 8, and can be used to convert any single-database install into a two-database install.

  • Create a new database (e.g. "example_civi") on the same server.
  • Do NOT create a separate MySQL user - just use the same MySQL user Drupal uses.
  • Grant permissions to the user. Here's the permissions you need:
TABLES, CREATE TEMPORARY TABLES, TRIGGER, CREATE ROUTINE, ALTER ROUTINE,
CREATE VIEW, SHOW VIEW, REFERENCES ON ``.* TO ''@'localhost';
  • Load a dump that just has CiviCRM tables into the new database. Steps to dump tables by prefix are available. Since you sound like you're potentially upgrading an existing site, you can just copy the existing database instead.

  • Drop the CiviCRM tables from the Drupal database. There's a good explanation of how to remove tables by prefix.

On the last step, note that foreign key constraints will cause some tables not to delete. You'll either need to run those steps multiple times or disable FK constraints before dropping the tables.

UPDATE: See also how to enable Views integration on D8 with separated databases.

  • 1
    Thank you Jon for this share of experience, so you recommend to create first the mixed database (D8 + Civi), then adapt the civicrm.settings.php to reach an external Civi database. I feel the way just tried is quite similar except that I add the civicrm.settings.php before the civicrm activation. So I will try again following your order and come bak to give the result. – Ichi Oct 21 '18 at 22:04
  • Hello Jon, I struggle too much to even set Civi w/ D8. May I ask you what is the method that you chose for the initial set of Civi w/ D8 ? In this page there is several methods w/ different version of Civi colorfield.be/blog/install-civicrm-5-with-drupal-8-using-lando - There is the method provided by David Snopek with the latest CiviCRM 5.6.0 or the another Drupal 8 CiviCRM module from GitHub that is currently verified to work against Drupal 8.0.5 and CiviCRM 4.7.3. I struggle w/ both method. My CiviCRM is 5.6.0. – Ichi Oct 22 '18 at 10:54
  • Yes, I create the mixed database first. I can't comment on whether separating them in civicrm.settings.php before install is effective - but I assume not, since the installer typically creates civicrm.settings.php. I use the David Snopek "full manual process" from his D8/Civi install instructions. – Jon G - Megaphone Tech Oct 22 '18 at 20:12
  • Thank you Jon, Following your advice, I kept trying to set Civi on Drupal8. After many tests I could successfully used the "full manual process" of David Snopek with the latest versions of Drupal and Civicrm : - Drupal 8.6.4 - CiviCRM 5.8.2 There is now new issues that arise with the CiviCRM extensions. – Ichi Dec 27 '18 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.