Gor*_*rle 1 php postgresql phppgadmin
我试图在 phpPgAdmin 中列出我的 localhost db,但它说没有找到对象phppgadmin GUI
我已经配置了 conf/config.inc
$conf['servers'][0]['desc'] = 'PostgreSQL'
$conf['servers'][0]['host'] = 'localhost';
$conf['servers'][0]['port'] = 5432;
$conf['owned_only'] = false;
Run Code Online (Sandbox Code Playgroud)
请提供任何帮助,我已尝试使用 Postgresql 版本 9.2、9.5、10.3(phppgadmin 不支持?)
问题说明
我看到问题了!此错误消息是 phpPgAdmin 代码中的一个错误,该代码显然具有在PHP 7.x 发布之前编写的旧代码。
如果您最近下载了包含所有最新版本的 PHP、PostGreSQL 和 phpPgAdmin 的技术堆栈,那么 phpPgAdmin 中的错误就会出现。例如……今天(2019 年 2 月)的最新版本是:
PHP.net在他们的构造函数和析构函数页面解释了这个问题:
警告 旧式构造函数在 PHP 7.0 中已弃用,并将在未来版本中删除。您应该始终在新代码中使用 __construct()。
他们的示例在该页面的本节中:
Example #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
}
}
?>
Run Code Online (Sandbox Code Playgroud)
现在我们知道问题是什么,下面是如何解决它。
解决方案
查看/phpPgAdmin/您的 Web 服务器上的文件夹。您应该在/classes/子文件夹中找到以下文件:
function ArrayRecordSet为function __constructfunction XHtmlSimpleElement为function __constructfunction GUI为function __constructfunction Misc()为function __constructfunction __constructfunction __construct编辑这些文件并将任何构造函数名称(显示为重复的类名)更改为__construct.
当您保存这些文件并在浏览器中重新加载 phpPgAdmin 时,您将看到“未找到对象”消息将消失。然后它会显示一个服务器名称。
瞧!最新版本的 phpPgAdmin 5.6 适用于最新版本的 PHP 7.3.1 和最新版本的 PostGreSQL 11!
如果您想检查左侧树的 XML 内容,只需将其附加到您的网站,因为这是 URL 的其余部分,它正在使用:/phppgadmin/servers.php?action=tree。这将有助于更轻松地调试 phpPgAdmin 代码。
您还可以删除action=treequerystring 参数。或者在 phpMyAdmin 代码中搜索它。
错误报告
我将看到有关提交phpPgAdmin 错误报告的内容以及指向此页面的链接。希望有人会在 phpPgAdmin 代码库中修复这个错误。
使用最新版本的 phpPgAdmin、PHP 和 PostGreSQL 玩得开心!
| 归档时间: |
|
| 查看次数: |
2002 次 |
| 最近记录: |