Wrong dbport used instead of the configuration one

<?php 
$OC_Version = array(22,2,2,0);
$OC_VersionString = '22.2.2';
$OC_Edition = '';
$OC_Channel = 'stable';
$OC_VersionCanBeUpgradedFrom = array (
  'nextcloud' => 
  array (
    '21.0' => true,
    '22.0' => true,
    '22.1' => true,
    '22.2' => true,
  ),
  'owncloud' => 
  array (
    '10.5' => true,
  ),
);
$OC_Build = '2021-11-12T15:56:53+00:00 dad659ae720e3138a3c13580777e7a5cf4cf8743';
$vendor = 'nextcloud';

Operating system and version (eg, Ubuntu 20.04): Centos
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.25
PHP version (eg, 7.4): 7.4

The issue you are facing: Nextcould try to connect on postgres servr port 5432 while 5434 is configured
Is this the first time you’ve seen this error? Y

The output of your Nextcloud log in Admin > Logging:

An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[08006] [7] could not connect to server: Connection refused
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432? in /var/www/nuage/lib/private/DB/Connection.php:87

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

grep db ./config/config.php
‘dbtype’ => ‘pgsql’,
‘dbname’ => ‘petitnuage’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘5434’,
‘dbtableprefix’ => ‘oc_’,

Yesterday, everything was working perfectly. I did not…, I think I did not…, do anything special since my last connection.

So, how does nextcloud look for a 5432 port while it is configured for 5434 one since the beginning a year ago !

Thanks for your help.

Have you tried to set the port within the dbhost parameter and remove the dbport parameter?

'dbhost' => 'localhost:5434',

Check where the MariaDB is running:
netstat -tulpen

Also you can use another configuration look this post.
Do you use/need IPv6? If not deactivate it.

Yes, it was has this before the problem occured, and I had changed to see (and I saw :slight_smile: )

I use postgresql

Sorry. My fault.

Have you read this documentation. You can use the port with the path to the socket-file. Perhaps this configuration help you.

No Problem.
Yes, but it does not help. I have no logs to tell me where it goes to take this wrong port parameter. It is amazing ! I had tried to connect to the database it works perfectly. I had check permissions on different files, socket included. I am stuck here with absolutely no idea of what could happen.

So I had modified twice the config/config.php as follow …

  1. modified ‘dbhost’ => ‘localhost’ to ‘dbhost’ => ‘localhost:5434’ kipping ‘dbport’ => ‘5434’

Tried to set maintenancemode to off and I got a different kind of error. Then, I did
2. modified ‘dbport’ => ‘5434’ to ‘dbport’ => ‘’ and kipping ‘dbhost’ => ‘localhost:5434’

Tried to set maintenancemode to off it replied that it is already off, meaning that it works. Indeed, it works !!!

The error log…

[Mon Mar 28 07:50:56.388071 2022] [proxy_fcgi:error] [pid 2880613:tid 140256644949760] (70007)The timeout specified has expired: [client 88.142.37.77:51612] AH01075: Error dispatching request to : (polling)
[Mon Mar 28 07:51:37.923743 2022] [proxy_fcgi:error] [pid 3252988:tid 140256493881088] [client 88.142.37.77:51616] AH01067: Failed to read FastCGI header
[Mon Mar 28 07:51:37.958956 2022] [proxy_fcgi:error] [pid 3252988:tid 140256493881088] (104)Connection reset by peer: [client 88.142.37.77:51616] AH01075: Error dispatching request to :
[Mon Mar 28 10:26:49.198946 2022] [proxy_fcgi:error] [pid 2880613:tid 140257045280512] (70007)The timeout specified has expired: [client 88.142.37.77:43750] AH01075: Error dispatching request to : (polling)
[Mon Mar 28 10:59:53.159851 2022] [proxy_fcgi:error] [pid 2604675:tid 140256843855616] [client 178.133.192.72:46076] AH01067: Failed to read FastCGI header
[Fri Apr 01 12:51:32.591282 2022] [proxy_fcgi:error] [pid 3252988:tid 140257036887808] [client 185.159.162.92:1943] AH01067: Failed to read FastCGI header
[Fri Apr 01 12:51:32.593382 2022] [proxy_fcgi:error] [pid 3252988:tid 140257036887808] (104)Connection reset by peer: [client 185.159.162.92:1943] AH01075: Error dispatching request to :
[Fri Apr 01 12:53:55.457634 2022] [proxy_fcgi:error] [pid 2604675:tid 140257078851328] (70007)The timeout specified has expired: [client 185.159.162.92:1956] AH01075: Error dispatching request to : (polling)
[Fri Apr 01 13:11:25.438301 2022] [proxy_fcgi:error] [pid 2604675:tid 140257053673216] (70007)The timeout specified has expired: [client 185.159.162.92:2001] AH01075: Error dispatching request to : (polling)
[Fri Apr 01 13:11:53.124325 2022] [proxy_fcgi:error] [pid 2604675:tid 140257078851328] (70007)The timeout specified has expired: [client 185.159.162.92:2001] AH01075: Error dispatching request to : (polling)Citation

Any explanation of what happened and what am I supposed to do ?

This is a bug?