# PDO\_PGSQL — outbound connection to external PostgreSQL database fails

**URL:** <https://forum.infinityfree.com/t/pdo-pgsql-outbound-connection-to-external-postgresql-database-fails/120562>\
**Category:** Hosting Support\
**Created:** [September 8, 2026, 8:33pm UTC](https://forum.infinityfree.com/t/pdo-pgsql-outbound-connection-to-external-postgresql-database-fails/120562 "2026-09-08T20:33:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saber646](https://forum.infinityfree.com/letter_avatar/saber646/32/5_5575768a8748004e209b776fc1b2916d.png) [@Saber646](https://forum.infinityfree.com/u/Saber646)\
**Post date:** [September 8, 2026, 8:33pm UTC](https://forum.infinityfree.com/t/pdo-pgsql-outbound-connection-to-external-postgresql-database-fails/120562/1 "2026-09-08T20:33:51Z")

</div>

### Website URL

[https://apimyapp.kesug.com](https://apimyapp.kesug.com)

### Error Message

{“success”:false,“message”:“Could not connect to server, please try again later”,“data”:null}

### Other Information

Hello,

I’m hosting a PHP-based REST API on my InfinityFree account (domain: [apimyapp.kesug.com](http://apimyapp.kesug.com)). My backend needs to connect to an external PostgreSQL database (hosted on a third-party provider) using the PDO\_PGSQL extension over the standard port (5432).

When I try to connect, the connection fails / times out, and I get a generic connection error from my own error handling.

Could you please help me confirm:

1. Does my hosting plan support outbound connections to external database servers (not hosted on InfinityFree)?
2. Is the pdo\_pgsql / pgsql PHP extension enabled on my account?
3. If outbound external DB connections are blocked by policy, is there any way (even on a paid/premium plan) to allow this?

Thank you for your time and help.

---

<div class="post-metadata">

**Author:** ![dan3008](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/dan3008/32/53336_2.png) [@dan3008](https://forum.infinityfree.com/u/dan3008)\
**Post date:** [September 8, 2026, 9:38pm UTC](https://forum.infinityfree.com/t/pdo-pgsql-outbound-connection-to-external-postgresql-database-fails/120562/2 "2026-09-08T21:38:41Z")

</div>

Welcome to the forum.

As I understand it there is a block on many outbound ports, that would prevent you being able to connect to a remote database.

Additionally, the hosting here is designed for websites not API’s so even if it did work, any non-browser trying to access your site would be blocked by the security system

---

<div class="post-metadata">

**Author:** ![KangJL](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/kangjl/32/12130_2.png) [@KangJL](https://forum.infinityfree.com/u/KangJL)\
**Post date:** [September 9, 2026, 3:11am UTC](https://forum.infinityfree.com/t/pdo-pgsql-outbound-connection-to-external-postgresql-database-fails/120562/3 "2026-09-09T03:11:51Z")

</div>

> [@Saber646](#):
>
> 1. If outbound external DB connections are blocked by policy, is there any way (even on a paid/premium plan) to allow this?

Sure, [premium hosting](https://www.infinityfree.com/premium/) has no such restriction

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [September 9, 2026, 8:19pm UTC](https://forum.infinityfree.com/t/pdo-pgsql-outbound-connection-to-external-postgresql-database-fails/120562/4 "2026-09-09T20:19:23Z")

</div>

> [@Saber646](#):
>
> 1. Does my hosting plan support outbound connections to external database servers (not hosted on InfinityFree)?

No.

> [@Saber646](#):
>
> 1. Is the pdo\_pgsql / pgsql PHP extension enabled on my account?

No.

> [@Saber646](#):
>
> 1. If outbound external DB connections are blocked by policy, is there any way (even on a paid/premium plan) to allow this?

I’m not completely sure about outbound connections, but [premium hosting](https://www.infinityfree.com/premium/) does support PostgreSQL hosting, which means that the required PHP extensions are available too.

> [@Saber646](#):
>
> I’m hosting a PHP-based REST API on my InfinityFree account

Ignoring the Postgres connection issues, this wouldn’t work in the first place. But also here applies: [premium hosting](https://www.infinityfree.com/premium/) is the solution, this is a free hosting only restrictions.

> [@Why isn't API access working on my website?](https://forum.infinityfree.com/t/why-isnt-api-access-working-on-my-website/115198):
>
> If you’re trying to use APIs on your InfinityFree website and they’re not working, this is due to our browser security system that’s required on all free hosting accounts. What’s happening? InfinityFree uses a security system that requires JavaScript and cookies to access websites. APIs and automated tools typically can’t execute JavaScript or store cookies, so they get blocked by the security system. When API clients try to connect, they usually receive a “403 Forbidden” error or a HTML respo…

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [September 16, 2026, 8:19pm UTC](https://forum.infinityfree.com/t/pdo-pgsql-outbound-connection-to-external-postgresql-database-fails/120562/5 "2026-09-16T20:19:46Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
