phppostgresqlphppgadmin

Phppgadmin, No objects found


I am trying to get my localhost db listed in phpPgAdmin, but it says No object found phppgadmin GUI

I have already configured conf/config.inc

$conf['servers'][0]['desc'] = 'PostgreSQL'
$conf['servers'][0]['host'] = 'localhost';
$conf['servers'][0]['port'] = 5432;
$conf['owned_only'] = false;

Any help please, I have tried with Postgresql versions 9.2,9.5,10.3(not supported by phppgadmin?)


Solution

  • EXPLANATION OF THE PROBLEM

    I see the problem! This error message is a bug in the phpPgAdmin code, which apparently has older code that was written before PHP 7.x was released.

    The error in phpPgAdmin will appear if you've recently downloaded a technology stack with all of the latest versions of PHP, PostGreSQL and phpPgAdmin. For example... today's (Feb. 2019) latest versions are:

    PHP.net explains the problem in their Constructors and Destructors page:

    Warning Old style constructors are DEPRECATED in PHP 7.0, and will be removed in a future version. You should always use __construct() in new code.

    Their example is in this section on that page:

    Example #2 Constructors in namespaced classes

    <?php
    namespace Foo;
    class Bar {
        public function Bar() { <- This is an older style of creating a constructor.
            For PHP 7.x, it should be changed to "__construct" instead of "Bar".
            // treated as constructor in PHP 5.3.0-5.3.2
            // treated as regular method as of PHP 5.3.3
        }
    }
    ?>
    

    Now that we know what the problem is, here is how to solve it.

    SOLUTION

    Look in your /phpPgAdmin/ folder on your web server. You should find the following files in the /classes/ sub-folder:

    Edit those files & change any of the constructor names - which appear as duplicate class names - to __construct.

    When you save those files & reload phpPgAdmin in your browser, then you will see that the "No objects found" message will have disappeared. It will then display a server name.

    VoilĂ ! The latest version of phpPgAdmin 5.6 works with the latest version of PHP 7.3.1 & the latest version of PostGreSQL 11!

    If you want to check the XML contents of that left tree, simply append this to your website as this is the rest of the URL, which it's using: /phppgadmin/servers.php?action=tree. That will help make debugging the phpPgAdmin code easier to do.

    You can also remove the action=tree querystring parameter. Or search for it inside of the phpMyAdmin code.

    BUG REPORT

    I'll see about submitting a phpPgAdmin bug report to with the link to this page. Hopefully, someone will fix this error in the phpPgAdmin code base.

    Have fun using the latest version of phpPgAdmin, PHP & PostGreSQL!