Reputation: 889
I have PHPPGAdmin installed on windows 10.
Postgres is fine and I can log into it on the command line.
But when I try to log into PHPPGadmin web UI I get the following error:
Virtual Class -- cannot instantiate
Here is my PHPPGAdmin config file:
<?php
$conf['servers'][0]['desc'] = 'PostgreSQL';
$conf['servers'][0]['host'] = 'localhost';
$conf['servers'][0]['port'] = 5432;
$conf['servers'][0]['sslmode'] = 'allow';
$conf['servers'][0]['defaultdb'] = 'template1';
$conf['servers'][0]['pg_dump_path'] = 'C:/xampp/PostgreSQL/13/bin/pg_dump';
$conf['servers'][0]['pg_dumpall_path'] = 'C:/xampp/PostgreSQL/13/bin/pg_dumpall';
$conf['default_lang'] = 'auto';
$conf['autocomplete'] = 'default on';
$conf['extra_login_security'] = false;
$conf['owned_only'] = false;
$conf['show_comments'] = true;
$conf['show_advanced'] = false;
$conf['show_system'] = false;
$conf['min_password_length'] = 1;
$conf['left_width'] = 200;
$conf['theme'] = 'default';
$conf['show_oids'] = false;
$conf['max_rows'] = 30;
$conf['max_chars'] = 50;
$conf['use_xhtml_strict'] = false;
$conf['help_base'] = 'http://www.postgresql.org/docs/%s/interactive/';
$conf['ajax_refresh'] = 3;
$conf['plugins'] = array();
$conf['version'] = 19;
?>
This is my phppgadmin config with the comments. This is my apache config in case these help.
What am I doing wrong, and how do I correct it?
Upvotes: 1
Views: 2569
Reputation: 188
I came upon this problem when I installed the latest phpPgAdmin 7.13.0 on a Windows server running PHP 8.1. There are fixes in GitHub that haven't made it onto the stable release version yet, but essentially this comment explains the minimal changes needed to make it work.
You need to edit two files in the phpPgAdmin installation:
all_db.php
, search for the line while (list ($key) = each ($data->codemap)) {
, which uses the obsolete PHP 'each' function, and replace it with foreach ($data->codemap as $key => $value) {
.libraries/adodb/drivers/adodb-postgres64.inc.php
, you have to replace the now obsolete constructor syntax using the class name function ADODB_postgres64()
with the proper syntax for constructors in PHP 8 function __construct()
.These two changes fixed the problem for me.
Upvotes: 4
Reputation: 889
I had to edit the C:\xampp\phpPGadmin\libraries\adodb\adodb.php
script to comment out the line with the 'Virtual Class -- cannot instantiate'
in it. That got it to work!
/**
* Constructor
*/
/**
function __construct()
{
die('Virtual Class -- cannot instantiate');
}
*/
It's probably not the best solution, but it does work. If anyone has a better answer please feel free to chime in.
Upvotes: 0
Reputation: 13
Are you running PHP 8? I'm running Linux, but I get this in phppgadmin since php updated to v8, worked fine with PHP v7. You might want to wait until some fixes are merged into phppgadmin to work with PHP 8.
Upvotes: 1