Page MenuHomePhabricator

Installation using non-standard PostgreSQL port fails with "7.3 or earlier" error message
Closed, DeclinedPublic

Description

Author: dale

Description:
In file DatabasePostgresq.php, function getServerVersion() the version_compare fails and reports that the version is 7.3 or earlier.

This is not just incorrect but misleading during installation.

The call to pg_version() is made with $this->mConn which is null.

A test for $this->mConn == null would avoid the misleading error message.

function getServerVersion() {
        if ( !isset( $this->numeric_version ) ) {
                if ($this->mConn == null) {
                   $this->numeric_version = 'No database connection';
                } else {
                $versionInfo = pg_version( $this->mConn );
                if ( version_compare( $versionInfo['client'], '7.4.0', 'lt' ) ) {
                        // Old client, abort install
                        $this->numeric_version = '7.3 or earlier';
                } elseif ( isset( $versionInfo['server'] ) ) {
                        // Normal client
                        $this->numeric_version = $versionInfo['server'];
                } else {
                        // Bug 16937: broken pgsql extension from PHP<5.3
                        $this->numeric_version = pg_parameter_status( $this->mConn, 'server_version' );
                }
                }
        }
        return $this->numeric_version;
}

Version: 1.19.3
Severity: normal
OS: Linux
Platform: PC
Whiteboard: aklapper-moreinfo
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=16937
https://bugzilla.wikimedia.org/show_bug.cgi?id=28162

Details

Reference
bz45225

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:14 AM
bzimport set Reference to bz45225.
bzimport added a subscriber: Unknown Object (MLST).

Are you getting some error message in the installer?

dale wrote:

The error message is that the postgres version is "7.3 or earlier".

However, as in my original post, that is misleading because the database connection was null. Therefore the pg_version() function failed.

Based on other errors I saw, what I suspect is happening is that the install ignores the Postgres setup on the initial install page. The page where it asks for IP and port for the database.

On Debian this is mostly port 5433 NOT 5432. However, the install code ignores this and tries to connect to the database on the default port. This will fail.

To work around this I found all occurrences of 5432 and edited/changed them to 5433 and the install worked.

dale wrote:

Two fixes IMO.

  1. use the port specified on the install page
  1. check for null on the database connection

One thing here is that you might run into bug 28162 which mean port number
is not accepted unless the page is reload (for example, by using "Back"
and "Continue" button).

I have changed my PostgreSQL server port number to 5433, used back and continue
buttons to really save it and then it installed the MediaWiki normally without
issues.

Even when PostgreSQL server was not running or some permission were wrong I got appropriate error messages and not the "wrong server version error".

I think the problem is somewhere else, are you using mediawiki downloaded from mediawiki.org? If not, can you try that one?

I was using version tagged in git (5186d6f5b7da98e43ddf2a194f58cf9c391800a6)
in my testing.

dale: If this is still a problem, could you answer comment 4, please?

Unfortunately closing this report as no further information has been provided.

dale: Please feel free to reopen this report if you can provide the information asked for in comment 4 and if this still happens. Thanks!

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.