使用 PostgreSQL 13.9 在 Debian 11.6 上安装 Joomla 4.2.9 时遇到数据库连接问题

问题描述 投票:0回答:0

我在使用 Apache2 和 PostgreSQL 的 Debian 11 网络服务器上设置 Joomla 时遇到困难。 Web 服务器在反向代理后面,PostgreSQL 数据库安装在另一台服务器上。

我的设置:

  • Debian 11.6(我的网络服务器)
  • Apache2 2.4.56
  • PHP 8.2.4
  • Joomla 4.2.9
  • PostgreSQL 13.9(在另一台服务器上)
  • HAProxy 2.2.9(在另一台服务器上)

我用来将我的网络服务器暴露给子域 www 的反向代理。 HAProxy 的配置如下所示。

backend www_server
        option forwardfor
        mode http
        server www1 192.168.A.B:<PORT>/www/ check

apache-config 看起来像这样。

<VirtualHost *:PORT>
        ServerName www.example.com
        ServerAdmin [email protected]
        DocumentRoot /var/www/joomla/

        <Directory /var/www/joomla>
                Options +Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                DirectoryIndex index.php
                Require all granted
        </Directory>
</VirtualHost>

PostgreSQL 运行正常。而且没有防火墙问题,因为我测试过它。

在我正确设置所有内容后,我输入了 URL:https://www.example.com/index.php 并且 Joomla 设置开始了。 当我在设置表单中输入 DB-Params 时,我会永久收到错误“发生数据库错误”。

然后我尝试检查我的 PHP 是否可以与另一台服务器上的 PostgreSQL 建立连接。幸运的是,我在 StackOverflow 上找到了以下脚本。它做得很好。

<?php
$connection = 'host=192.168.X.Y port=5432 dbname=joomla_db user=foo password=bar';
$dbconn = pg_connect($connection);
$result = pg_query($dbconn, "select * from pg_stat_activity");

var_dump($dbconn);
var_dump(pg_fetch_all($result));

脚本让我得到这样的结果。

object(PgSql\Connection)#1 (0) { } array(9) { [0]=> array(21) { ["datid"]=> NULL ["datname"]=> NULL ["pid"]=> string(3) "542" ["leader_pid"]=> NULL ["usesysid"]=> NULL ["usename"]=> NULL ["application_name"]=> string(0) "" ["client_addr"]=> NULL ["client_hostname"]=> NULL ["client_port"]=> NULL ["backend_start"]=> NULL ["xact_start"]=> NULL ["query_start"]=> NULL ["state_change"]=> NULL ["wait_event_type"]=> NULL ["wait_event"]=> NULL ["state"]=> NULL ["backend_xid"]=> NULL ["backend_xmin"]=> NULL ["query"]=> string(24) "" ["backend_type"]=> NULL } [1]=> array(21) { ["datid"]=> NULL ["datname"]=> NULL ["pid"]=> string(3) "544" ["leader_pid"]=> NULL ["usesysid"]=> string(2) "10" ["usename"]=> string(8) "postgres" ["application_name"]=> string(0) "" ["client_addr"]=> NULL ["client_hostname"]=> NULL ["client_port"]=> NULL ["backend_start"]=> NULL ["xact_start"]=> NULL ["query_start"]=> NULL ["state_change"]=> NULL ["wait_event_type"]=> NULL ["wait_event"]=> NULL ["state"]=> NULL ["backend_xid"]=> NULL ["backend_xmin"]=> NULL ["query"]=> string(24) "" ["backend_type"]=> NULL }
<... more data...>
} 

这告诉我,可以使用 PHP 建立从我的网络服务器到我的 PostgreSQL 的正确连接。但是 Joomla 不会自行安装。在 Joomla

的设置表单中输入连接参数后

Joomla Setup Form - database part

错误“发生数据库错误。”永久出现。

Joomla Setup Form - error message

我几乎被困在这里。有人可以帮助我吗?

非常感谢。

postgresql joomla apache2 haproxy
© www.soinside.com 2019 - 2024. All rights reserved.