Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing phpPgAdmin 5.1 on Ubuntu 16.04 with PostgreSQL 10 not supported

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?

like image 545
Ong Ming Soon Avatar asked Oct 17 '17 16:10

Ong Ming Soon


4 Answers

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.

like image 197
DToch Avatar answered Dec 20 '22 01:12

DToch


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

like image 25
e_i_pi Avatar answered Dec 20 '22 01:12

e_i_pi


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.

like image 22
Bill Milagro Avatar answered Dec 20 '22 01:12

Bill Milagro


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
like image 43
Charlie Avatar answered Dec 20 '22 00:12

Charlie