In 1.27.1, when using the web installer, I enter a non-default port number for the PostgreSQL database server. But when it first tries to connect to the database server to set up the schema, it ignores this and connects to the default port (5432) anyway.
If it succeeds (because I also have a database server running on the default port), then it installs the schema in the server running on port 5432, but it creates a LocalSettings.php file which includes the non-default port I entered. Which of course is missing the schema.