Different databases for one limesurvey system?

4 years 1 month ago #91987 by jesovn
Hi, I'm actually developing an application that uses Limesurvey.

This application needs different databases, one for each "department".

I've created different LimeSurvey databases. For that, I modify the Surveys URL, adding a parameter to this URL. Looks like this:


The "index.php" stores in SESSION the "departmentID", and then the "config.php" reads this SESSION variable to switch between different databases. It works for doing the surveys, and if I want to enter into the admin page it also works with this URL:


But with the remotecontrol2 it doesn't work. My application stores in SESSION the departmentID, but when I use the RemoteControl I can't get the sessionKey (there's an exception).

I'd like to know how I could configure the remotecontrol to switch between different databases like in the other use. Or if it is possible to send this parameter to the remotecontrol....

Please help, the only other solution is to have a limesurvey proyect for each department. I know that it isn't an usual use of limesurvey... but could be nice to modify Limesurvey to have this capability.

Thanks in advance! Best regards,

Please Log in to join the conversation.

4 years 1 month ago - 4 years 1 month ago #92023 by DenisChenu

With different server name, it's "relative" easy.

You can test the server name in config.phpo and set the detabase according to the servername.

For example:

And change the array with:
'components' => array(
		'db' => array(
			'connectionString' => $connectionString,

Here, LS use is own session_name, think it's difficult to tak session var from another session before using session of LimeSurvey.

Maybe another idea is to have symbolic link for limesurvey directory and test the dirname of config.php to set the $connectionString.


Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 4 years 1 month ago by DenisChenu. Reason: remove extra "
The following user(s) said Thank You: jesovn

Please Log in to join the conversation.

4 years 1 month ago #92036 by jesovn
Thank you DenisChenu!! I've solved it! =D Very useful!

Please Log in to join the conversation.