# Can I upgrade a drupal 7 + civi site to drupal 8?

There is maybe a simpler path but this worked for me. Documenting this here since I don't know where else to put it.

UPDATE: Note this is now slightly out of date but the gist is correct, so follow the spirit if not the exact details. In particular if I was doing it again now there is a non-roundearth way to also install D8+civi, e.g. https://civicrm.stackexchange.com/a/35608/181 (official docs are in the works), and that method will set different path settings in civicrm.settings.php for you than described below, e.g.

$civicrm_paths['civicrm.files']['url'] = 'http://example.com/sites/default/files/civicrm';$civicrm_paths['civicrm.files']['path'] = '/full/filesystem/path/to/sites/default/files/civicrm';


1. Start creating a new D8+civi site by using the installer at https://gitlab.com/roundearth/drupal-civicrm-project.

2. When doing the D8 install part, just install a minimal site and don't further configure it - just what's needed to get D8 installed.

4. Do not enable civicrm yet.

5. From your old site, export the civicrm_xxx tables.

6. There is probably a better way to do this step but it worked for me to manually update any urls and paths in the export file (taking care with php-serialized strings) and then import the sql file into the new database. Note that any references to sites/all/modules/civicrm are now under vendor/civicrm/civicrm-core. URLs for sites/default/files/... can stay as is, but note that filepaths will now be web/sites/default/files. Also userFrameworkResourceURL is now libraries/civicrm.

7. Copy civicrm.settings.php to the new site under web/sites/default. Edit the file: Change CIVICRM_UF from "Drupal" to "Drupal8". Change the mysql connection strings. Change paths and urls as above. Again note civicrm_root is now under vendor/civicrm/civicrm-core, and you need to put "web/" in front of filepaths to "sites/XXX".

8. Enable the civicrm module.

9. Clear caches at admin/config/development/performance and also the civicrm caches at civicrm/admin/setting/updateConfigBackend?reset=1. I also ran /civicrm/menu/rebuild?reset=1 but I'm not sure it's necessary here.

10. The UI will look all messed up because it was a minimal drupal install but you can change the theme and set things as you normally would.

11. You may also need to set these settings in civicrm.settings.php: $civicrm_setting['URL Preferences']['userFrameworkResourceURL'] = CIVICRM_UF_BASEURL . '/libraries/civicrm/';$civicrm_paths['civicrm.root']['url'] = CIVICRM_UF_BASEURL . '/libraries/civicrm/'; $civicrm_setting['domain']['userFrameworkResourceURL'] = CIVICRM_UF_BASEURL . '/libraries/civicrm/';$civicrm_paths['cms.root']['path'] = '/full/path/to/web'; // the "web" folder at the root of the install

• It sounds like in step 6 you've got URLs going to vendor/civicrm/civicrm-core, but that typically isn't web-accessible. Maybe they should go to libraries/civicrm instead? – Jon G - Megaphone Tech Feb 26 '19 at 19:03
• Yes the urls should go to libraries/civicrm, but anything that previously pointed to the file path in the filesystem for sites/all/modules/civicrm now need to be vendor/civicrm/civicrm-core. I admit this isn't a detailed list of what settings to change. I'm thinking there must be a better way anyway since this would hopefully never be the official way to do it. Just this worked for me. – Demerit Feb 26 '19 at 19:09
• maybe creating this as a new entry in civicrm dev docs?: github.com/civicrm/civicrm-dev-docs – luciano_s Feb 27 '19 at 16:27