Connection to a Postgresql databse on a remote server failed

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Get Involved
Post Reply
jpouille
Registered User
Posts: 2
Joined: Thu Mar 10, 2022 2:13 pm

Connection to a Postgresql databse on a remote server failed

Post by jpouille »

Hi,

I want to install phpBB3.2 on one server and a Postgresql database on a remote server.

In the installation panel I fill the database connection but I have the following error :

Errno 2: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission denied

.Can someone help me ?

thanks
Last edited by P_I on Wed Apr 06, 2022 10:34 am, edited 1 time in total.
Reason: This is a server setup issue so moved to phpBB discussion
User avatar
AlfredoRamos
Recognised Extension Developer
Posts: 1302
Joined: Wed Dec 25, 2013 9:06 pm
Location: /dev/null
Name: Alfredo
Contact:

Re: Connection to a Postgresql databse on a remote server failed

Post by AlfredoRamos »

I'll assume you enabled the TCP/IP access to your PostgreSQL server, so just make sure you added the IP address of the server where you'll run phpBB to enable the remote access to it.

Also double check that the connection info is correct and your firewall allows connection to that port.
Some of my phpBB extensions:
:chart_with_upwards_trend: SEO Metadata | Image Markdown | :shield: hCaptcha
:trophy: Check out all my validated extensions :trophy:

:penguin: Arch Linux user | Linux Boards :penguin:
jpouille
Registered User
Posts: 2
Joined: Thu Mar 10, 2022 2:13 pm

Re: Connection to a Postgresql databse on a remote server failed

Post by jpouille »

With pgadmin 4 I can connect to my database if I enable sslmode=require.

Do you know how can I active sslmode on the server where phpBB3.2 is deployed ?
User avatar
P_I
Community Team Member
Community Team Member
Posts: 2353
Joined: Tue Mar 01, 2011 8:35 pm
Location: Western Canada 🇨🇦
Contact:

Re: Connection to a Postgresql databse on a remote server failed

Post by P_I »

Might I ask why you are planning to install phpBB 3.2?

From the phpBB 3.2.11 Release announcement, in November 2020.
Marc wrote: Fri Nov 06, 2020 2:54 pm As you might be aware, the 3.2 branch has almost approached its End of Life and will not receive further security updates after November 7th, 2020. We’d like to remind everyone to upgrade to phpBB 3.3 as soon as possible.
If this is a new installation then I'd strong recommend starting with phpBB 3.3, the latest is the phpBB 3.3.7 Release.
Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams
User avatar
AlfredoRamos
Recognised Extension Developer
Posts: 1302
Joined: Wed Dec 25, 2013 9:06 pm
Location: /dev/null
Name: Alfredo
Contact:

Re: Connection to a Postgresql databse on a remote server failed

Post by AlfredoRamos »

jpouille wrote: Wed Apr 06, 2022 6:21 am Do you know how can I active sslmode on the server where phpBB3.2 is deployed ?
It's not possible to set or read the SSL mode from the config.php file, or any other way really.

Usually it's very discouraged to modify core files, however since it's currently not possible to add that option other way, you could edit the file phpbb/db/driver/postgres.php

Search (reference):

Code: Select all

$connect_string .= "dbname=$database";
And replace it with:

Code: Select all

$connect_string .= "dbname=$database";
$connect_string .= ' sslmode=require';
The preferred way would be to open a new ticket in the tracker, so developers can make the changes needed.
Some of my phpBB extensions:
:chart_with_upwards_trend: SEO Metadata | Image Markdown | :shield: hCaptcha
:trophy: Check out all my validated extensions :trophy:

:penguin: Arch Linux user | Linux Boards :penguin:
Post Reply

Return to “phpBB Discussion”