[development] Connecting to multiple databases in 5.x

Karen Stevenson karen at elderweb.com
Fri Dec 29 20:53:43 UTC 2006

In windows at least, the file is actually made read-only and I never saw any status message telling me that. That's OK and makes sense, but was a surprise when I tried to edit the file and couldn't. My concern was that if I temporarily removed the read-only access and made my changes that I was going to do something that would create big problems for me down the road (i.e. that it was write-protected partly so that nothing on it would get altered in any way, even by me). So at the very least, any documention that talks about making changes to the settings.php file from 5.x on should mention that the file may be write-protected but it is OK to remove the protection, make the changes, and re-protect it, since the fact that it is read-only is going to scare others away from changing it.

This came up because I have a module that needs a connection to an external database to work and my previous instructions to users were to make that change in their settings file, but the fact that it is now write-protected might frighten them unnecessarily. I did it that way instead of asking them to input the database connection info on the settings page because I really don't like storing info like that in the database.

Anyway, if I don't have to worry about breaking something by making that change, I can go back to doing it this way and document this in my INSTALL.txt file.



----- Original Message ----
From: Chris Kennedy <chrisken at mail.utexas.edu>
To: development at drupal.org
Sent: Friday, December 29, 2006 12:29:54 PM
Subject: Re: [development] Connecting to multiple databases in 5.x

Settings.php is made read-only on install if possible (using
drupal_verify_install_file). See http://drupal.org/node/105368 which
adds a status message to clarify this (and needs a review). Or maybe it
would be better to have the read-only change be a checkbox on the
install page that is enabled by default but can be disabled.

Also keep in mind that Drupal gives incorrect error messages in some
cases when settings.php is unreadable or doesn't exist. This might make
you think your database settings are wrong, when it is really a
permissions issue. http://drupal.org/node/100476 fixes some of these
cases (and needs a review).

So, theoretically http://drupal.org/node/18429 should still work.

Morbus Iff wrote:
>> Now that the settings.php file is write protected, the instructions
>> at http://drupal.org/node/18429 no longer work to connect to multiple
>> databases. I searched around but wasn't able to find anything on a
>> recommended way to do this in 5.x. And, of course, the documentation
>> on that page needs to be updated, too.
> settings.php is not write-protected. More than likely:
>  * your webserver is a user and group that you don't have access to.
>  * when the install.php wrote your settings.php for you, it was
>    unable to give you proper permissions to write to the file.
> Drupal does not enforce write protection on the settings.php.
> The above is still the right way of doing multiple databases.
> The installer should be creating the file as writable. Could you tell
> us more about the permissions and ownership it created for that file?

More information about the development mailing list