7

Install based on https://www.howtoforge.com/tutorial/ubuntu-postgresql-installation/ in my ubuntu 16.04

Log into http://localhost/phppgadmin/ PostgreSQL, browser show Version of PostgreSQL not supported. Please upgrade to version or later.

Any resolution?

Ong Ming Soon
  • 1,041
  • 1
  • 10
  • 22

6 Answers6

20

Actually you still can modify this file manually:

classes/database/Connection.php

// Detect version and choose appropriate database driver
switch (substr($version,0,3)) {
    case '9.5': return 'Postgres'; break;
    case '9.4': return 'Postgres94'; break;
    case '9.3': return 'Postgres93'; break;
    case '9.2': return 'Postgres92'; break;
    case '9.1': return 'Postgres91'; break;
    case '9.0': return 'Postgres90'; break;
    case '8.4': return 'Postgres84'; break;
    case '8.3': return 'Postgres83'; break;
    case '8.2': return 'Postgres82'; break;
    case '8.1': return 'Postgres81'; break;
    case '8.0':
    case '7.5': return 'Postgres80'; break;
    case '7.4': return 'Postgres74'; break;
}

switch (substr($version,0,4)) {
    case '10.1': return 'Postgres'; break;
}

Not fully tested, but all the main functions work fine.

Or create your own fork of https://github.com/phppgadmin/phppgadmin and create/fix a couple of files for implementing full support.

DToch
  • 211
  • 1
  • 6
8

EDIT 3: phpPgAdmin is in active development again! If you download the latest version, it supports PostgreSQL up to v11.x

http://phppgadmin.sourceforge.net/doku.php?id=download https://github.com/phppgadmin/phppgadmin


phpPgAdmin hasn't been actively developed for years. It's still a great interface for PostgreSQL, but unfortunately they only officially support up to 9.2. I've noticed that the latest version still works up to 9.6 though, at least it has in a production environment for the past 6 months, and before that worked with whatever I had (9.4 / 9.5?) for years.

I would suggest installing 9.6 instead, and going from there.

EDIT: If you're dead keen on using v10, then you can still use pgAdmin 4 as the interface, though this is not web based.

Reference: Official phpPgAdmin Website

EDIT2: See the answer by DToch for a good workaround

e_i_pi
  • 4,590
  • 4
  • 27
  • 45
8

To be clearer, the full path is /usr/share/phppgadmin/classes/database/Connection.php

Also you can simply add

default: return 'Postgres'; break; 

at the end of the switch statement.

Also needed is the username for logging in should be "postgres". Not well documented.

Bill Milagro
  • 131
  • 1
  • 6
3

If you're using docker (Using my fork of phppgadmin due that fixes compatibility with newer posrgres):

FROM php:8-fpm-alpine

RUN apk add --no-cache --virtual \
     .build-deps git autoconf g++ make postgresql-dev \
  && docker-php-ext-install pgsql \
  && docker-php-ext-enable opcache \
  && apk add libpq ca-certificates curl apache2-proxy \
  && rm -rf /var/www/localhost/.git/ /var/www/localhost \
  && git clone https://github.com/idontusenumbers/phppgadmin.git /var/www/localhost/htdocs \
  && rm -rf /var/www/localhost/.git/ \
  && apk del .build-deps  \
  && rm -rf /tmp/* \
  && rm -rf /var/cache/apk/* \
  && rm /etc/init.d/apache2


RUN echo "ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/localhost/htdocs/$1" >> /etc/apache2/httpd.conf
RUN echo "DirectoryIndex index.php" >> /etc/apache2/httpd.conf
Charlie
  • 8,530
  • 2
  • 55
  • 53
  • Hi, I replied your comment because you mentioned on docker. I tried to use your Dockerfile script, but I got error of "PHP version is not supported whenever I try to access the phppgadmin page. Please use 7.2 or above." So I build a PHP container on the same network, but the phppgadmin it doesn't detect the PHP container as I still got the error message. Any help? I ran the phppgadmin on Docker. Thank you. – Haizad Annuar Dec 25 '20 at 15:11
  • This phppgadmin container here contains a copy of PHP. Although I've changed since I posted this, I'll update. – Charlie Dec 26 '20 at 05:15
  • Thanks for the updated code!. Turns out that the dockage/phppgadmin image didn't support for Postgresql 13 yet, (I guess so). Your original post works if downgraded the version into 11. I will try to use your new edited version from now on. :D – Haizad Annuar Dec 26 '20 at 10:30
0

in phppgadmin folder edit the file classes/database/Connection.php

Add after this line: case '7.4': return 'Postgres74'; break;

type or copy/paste this text: default: return 'Postgres'; break;

Et voila!

0

in the directory classes/database adjust the file connection.php switch (substr($version,0,3)) {

        case '9.2': return 'Postgres'; break;
        case '9.1': return 'Postgres91'; break;
        case '9.0': return 'Postgres90'; break;
        case '8.4': return 'Postgres84'; break;
        case '8.3': return 'Postgres83'; break;
        case '8.2': return 'Postgres82'; break;
        case '8.1': return 'Postgres81'; break;
        case '8.0':
        case '7.5': return 'Postgres80'; break;
        case '7.4': return 'Postgres74'; break;
        default: return 'Postgres'; break;
    }

and it works also for version 10 without issues.

This also solves the issue when you have the following error message: Undefined variable: postgresqlMinVer Version of PostgreSQL not supported. Please upgrade to version or later.