Hello,

We currently have a custom-written cloud-based application for the education industry, written in PHP with a framework that we have written ourselves.
Each customers data is placed in its own database since legal requirements require that users, documents and other data be well separated from other customers' data.
We have decided that we do not wish to maintain our own code for logging in, database abstraction etc, and would like to get access to the module-based world of Drupal. However, most cms:s keep all the information in one database.

What options/possibilites do Drupal give us here?

Best

Per

Comments

kscheirer’s picture

Drupal supports this use case using a concept called multisites. The idea is that you have 1 codebase (your drupal core + additional installed modules and themes), but you can have discreet databases for each customer. You would generally set this up by using different domain names for each customer and each customer would have an entirely separate DB. You can find more info on this in Drupal's installation instructions, and at Multi-site how-tos including videos.

There's many ways to get this going depending on your specific needs. It's possible to share some tables between all your sites if that's helpful. Drupal is also able to connect to any number of additional databases, that could be another way to handle it. You core Drupal install could make use a database to hold most data, and you could keep sensitive customer data in completely separate databases.

Hope that helps!

pereriksson’s picture

Hello!

Thank you for your response. This has helped us a lot, and we have now looked more closely at Drupal's multi site functionality.
The links also pointed us to a a lot of helpful resources.
We however can't find the part where we can specify several databases for different sites in the multi site configuration, only different prefixes within the same database.

Is this possible as well?

Thanks,

Best

Per

kscheirer’s picture

That info is hidden in the sites/default/default.settings.php file comments. Basically Drupal needs at least 1 database to store its core tables on, but you can give it connection info to as many as you want.

This doc goes into a little more detail: How to connect to multiple databases within Drupal. Here the DB connection is being given on the fly, meaning in your custom code, which does not require any modifications to settings.php. But it's often easier to just put all the connection info directly into settings.php, as this comment points out.