Problem/Motivation

Currently Drupal supports sockets for mysql and pgsql, but it is completely undocumented and requires modifying settings.php manually. Socket support is mostly accidental in the case of pgsql so this should be more explicit.

This has been mentioned before in issues #793200: Document all database settings in default.settings.php, #849078: Failed to connect to MySQL server during installation, #564728: PostgreSQL socket connection support during installation, #26836: Socket Connection/path support (especially on PostgreSQL), and several support requests.

Proposed resolution

- Make the installer ask for the host or socket.
- Make the default for pgsql be a blank host/socket. Postgres will first try a socket, if that fails it will try localhost.
- MySQL default should stay localhost, as this value is a magic value where it is converted to the socket if available.
- Sockets are only available on *nix systems so Windows might need other defaults.

Remaining tasks

- Probably could use some tests. Haven't looked into this yet.
- Is there a better way to overwrite the $database values instead of adding the pass-by reference to validateDatabaseSettings?
- For those who do use a host should we set the default port in the installer and not set default values in the connection code. I doubt the ternary operator is a huge impact on performance, but it seems like something that could be avoided on every page load with a more sane installer.
- I've also fixed that errors in advanced options aren't displayed correctly as advanced_options isn't parsed added to the form fields. Might be a better way to do this, but I'm still unfamiliar with the full install code. Might roll this into its own issue.
- Needs some more testing on different OSes and PHP configurations.

User interface changes

- Change the text in the install for the host field.

API changes

- None.

CommentFileSizeAuthor
#1 1368862-0.patch7.69 KBKjartan

Comments

Kjartan’s picture

Status: Active » Needs review
StatusFileSize
new7.69 KB

Initial patch. Needs some work still, but could use some feedback from others with more familiarity with the install/database systems.

Status: Needs review » Needs work

The last submitted patch, 1368862-0.patch, failed testing.

Kjartan’s picture

Status: Needs work » Needs review

#1: 1368862-0.patch queued for re-testing.

Kjartan’s picture

Status: Needs review » Closed (duplicate)