【问题标题】:Phppgadmin, No objects foundPhppgadmin,未找到对象
【发布时间】:2018-09-27 13:04:20
【问题描述】:

我正在尝试在 phpPgAdmin 中列出我的 localhost 数据库,但它显示 No object found phppgadmin GUI

我已经配置了conf/config.inc

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

请帮忙,我已经尝试过 Postgresql 版本 9.2、9.5、10.3(phppgadmin 不支持?)

【问题讨论】:

    标签: php postgresql phppgadmin


    【解决方案1】:

    问题说明

    我看到了问题!此错误消息是 phpPgAdmin 代码中的错误,该代码显然具有在 PHP 7.x 发布之前编写的旧代码。

    如果您最近下载了包含所有最新版本的 PHP、PostGreSQL 和 phpPgAdmin 的技术堆栈,则会出现 phpPgAdmin 中的错误。例如...今天(2019 年 2 月)的最新版本是:

    • PHP 7.3.1
    • PostGreSQL 版本 11
    • phpPgAdmin 5.6(2018 年 11 月 12 日)

    PHP.net 在他们的Constructors and Destructors 页面中解释了问题:

    警告旧式构造函数在 PHP 7.0 中已弃用,并将被 在未来的版本中删除。您应该始终使用 __construct() 新代码。

    他们的示例在该页面的此部分中:

    命名空间类中的示例 #2 构造函数

    <?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
        }
    }
    ?>
    

    现在我们知道了问题所在,下面是如何解决它。

    解决方案

    查看您的网络服务器上的/phpPgAdmin/ 文件夹。您应该在/classes/ 子文件夹中找到以下文件:

    • ArrayRecordSet.php function ArrayRecordSet 替换为function __construct
    • class.select.php function XHtmlSimpleElement 替换为 function __construct
    • Gui.php function GUI 替换为 function __construct
    • Misc.php function Misc() 替换为 function __construct
    • Plugin.php function __construct
    • PluginManager.php function __construct

    编辑这些文件并将任何构造函数名称(显示为重复的类名称)更改为 __construct

    当您保存这些文件并在浏览器中重新加载 phpPgAdmin 时,您将看到“未找到对象”消息将消失。然后它将显示一个服务器名称。

    瞧!最新版 phpPgAdmin 5.6 可与最新版 PHP 7.3.1 和最新版 PostGreSQL 11 一起使用!

    如果您想检查左侧树的 XML 内容,只需将其附加到您的网站,因为这是 URL 的其余部分,它正在使用:/phppgadmin/servers.php?action=tree。这将有助于更轻松地调试 phpPgAdmin 代码。

    您还可以删除action=tree 查询字符串参数。或者在 phpMyAdmin 代码中搜索。

    错误报告

    我将了解如何提交带有此页面链接的phpPgAdmin bug report。希望有人会在 phpPgAdmin 代码库中修复此错误。

    享受使用最新版本的 phpPgAdmin、PHP 和 PostGreSQL 的乐趣!

    【讨论】:

    猜你喜欢
    • 2015-09-24
    • 1970-01-01
    • 2013-11-23
    • 2017-05-01
    • 2012-06-13
    • 2021-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多