Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Connect a Cloud Server to an external database

Update 08/06/2026

This guide explains how to connect to an external database from a Cloud Server.

 

Introduction

  • It is possible to connect to MySQL via SSL (whether external or not) - this should be specified when establishing the connection.
  • The MySQL port 3306 is closed by default - to open it, please refer to this other guide.
  • Infomaniak does not install PDO_DBLIB.

 

Install PHP_PDO_ODBC

Prerequisites

You can install the PHP_PDO_ODBC extension from the PHP Extensions menu of your Cloud Server:

  1. Click here to access the management interface for your product on the Infomaniak Manager (need help?).
  2. Click directly on the name assigned to the product in question.
  3. Click on PHP Extensions in the left-hand menu.
  4. Click on the blue Install an extension button.
  5. Choose the PHP_PDO_ODBC extension.
  6. Confirm the installation.

 

Configure the connector

The driver configuration is already defined in /etc/odbcinst.ini:

[FreeTDS]
Description = MS SQL database access with Free TDS Driver
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so

There is no need to redefine it statically in the .odbc.ini or in the user's home directory ‍~~/.odbc.ini‍, or even dynamically in the PHP code.

For example, with the FreeTDS driver defined beforehand, the driver version must also be specified at the end of the pdo object declaration:

$con = new PDO('odbc:Driver=FreeTDS;Server=__SERVER IP__;Port=3306;DATABASE=__DATABASE NAME__;UID=__USERNAME__;PWD=__PASSWORD__;TDS_Version=8.0');

Has this FAQ been helpful?