Knowledge base

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

This guide concerns the ODBC functions of PHP.

 

The ODBC functions of PHP are only supported on Managed Cloud Server.

 

Open Database Connectivity functions

These are the functions used to interact with databases via the ODBC (Open Database Connectivity) interface, a standard for accessing data sources uniformly. Here are some examples of using the ODBC functions of PHP:

  • Being able to read data from an external database and display it on your website
  • Insert or modify data in an external database
  • Perform complex queries on an external database

Has this FAQ been helpful?

This guide covers ImageMagick, a powerful software suite for image manipulation, available on Infomaniak's Web Hosting and Cloud Servers.

 

Simplified Installation: To install ImageMagick or its extensions, we recommend using Fast Installer from your Manager.

 

ImageMagick and image manipulation solutions

Several tools are available to process your visuals (resizing, conversion, watermarks):

  1. ImageMagick (CLI): the main suite usable via command line (via SSH); the modern command is magick, but the old syntax convert is still available.
  2. PHP Extension imagick: this is the most common solution for websites (WordPress, etc.); it allows you to use ImageMagick directly in your PHP scripts.
  3. GD Library: a lighter alternative, often pre-installed, ideal for simple manipulations (thumbnails, text on image).
  4. PerlMagick: dedicated interface for Perl scripts to access ImageMagick features.

 

Paths and Commands

On Infomaniak infrastructures, ImageMagick is installed by default. The executables are located in the following directory:

/usr/bin/

Here are the main available commands:

CommandMain Usage
magick (or convert)Convert, resize, and transform images.
identifyRetrieve the metadata of a file (format, size, etc.).
mogrifyApply a modification directly to the original file.
compositeOverlay multiple images (e.g., adding a logo as a watermark).

To test the presence of the Perl module Image::Magick, you can use the following command:

perl -e 'use Image::Magick; print "Installed\n"';

Has this FAQ been helpful?

This guide details the use of Crontab (crons via SSH), available only on Managed Cloud Server, by default (there is also a task scheduler for all hosting).

 

Prerequisites

  • The script files called by the cron must be executable (CHMOD).

 

Full path

Cron tasks do not know the absolute path. Calling PHP without specifying the full paths to the executable makes it impossible to execute the task. You must specify

/opt/phpX.X/bin/php

by replacing X.X with the desired PHP version (/opt/php8.1/bin/php for example).

 

Other operations

For example:

  • List the crons of the SSH user in question:

    crontab -l -u Username
  • Edit the crons:

    crontab -e -u Username
  • Be notified by email of the result of your cron tasks (to be added at the beginning of the file):

    MAILTO=e-mail@domain.xyz

 

Restore a backup

Infomaniak backs up the crons of the last 7 days (once a day). In case of accidental deletion, contact Infomaniak support to request a restoration specifying the time and date of the deletion.


Has this FAQ been helpful?

This guide details the header X-Frame-Options, used to protect your site against clickjacking (click hijacking).

The value ALLOW-FROM is now obsolete. To allow a specific domain, it is recommended to use the header Content-Security-Policy (CSP) with the directive frame-ancestors.

 

Values for the X-Frame-Options header

This header tells the browser whether to allow or not the display of your page in a <frame> or <iframe> tag.

  1. "DENY" : Complete prohibition. The site cannot be loaded in any frame, even from your own site.
  2. "SAMEORIGIN" : Allows display in an iframe only if the parent site has the same domain as the content.

Implement the header

Via the .htaccess file (recommended for the entire site) :

Header set X-Frame-Options "SAMEORIGIN"

Or via PHP (for a specific page) :

<?php
header('X-Frame-Options: SAMEORIGIN');
?>

 

The modern alternative: Content-Security-Policy (CSP)

If you need to allow a specific external site (e.g. domain.xyz) to embed your content, do not use X-Frame-Options but the following header in your .htaccess :

Header set Content-Security-Policy "frame-ancestors 'self' https://domain.xyz"

This rule allows your own site ('self') as well as domain.xyz to display you in an iframe.


Has this FAQ been helpful?

This guide covers the Apache module mod_auth_mysql which allows user authentication and access authorization via a MySQL database.

 

With shared hosting

The module mod_auth_mysql is not available with shared hosting; you need to consider a Cloud Server or use PHP scripts and sessions.


Has this FAQ been helpful?

This guide details the management of incoming and outgoing connections (incoming and outgoing connections) between your different hosting environments, specifically for remote access to databases.

 

Database connections between hostings

 

1. From a Web Hosting (Shared)

If you have a Web Hosting (except for the old offer "v1 - 60 Go"), you can establish a connection to databases located on:

  • another Web Hosting (shared),
  • a Cloud Server type hosting.

This flexibility allows you to share a database between multiple sites, establish remote connections, or configure cross-access between your services.

 

2. From a Cloud Server

With a Cloud Server, it is possible to connect to databases hosted on another Cloud Server in your fleet:

  • Make sure that port 3306 (protocol TCP) is open for incoming traffic in your firewall.
  • If you restrict access to certain addresses, check the rules for the IPv4 and IPv6 protocols.

Important note: outgoing connections from a Cloud Server to the databases of a shared hosting are not allowed.

 

3. From an external provider

If you want to access your MySQL databases from a server or a tool located outside the Infomaniak infrastructure (third-party provider, local application, etc.), refer to this other guide.


Has this FAQ been helpful?

This guide explains how to enable or disable the PHP function set_time_limit of a Web Hosting.

 

Preamble

 

Enable or disable the PHP set_time_limit function

To access website management:

  1. Click here to access the management of your product on the Infomaniak Manager (need help?).
  2. Click directly on the name assigned to the product concerned:
  3. Click on Manage under Advanced settings:
  4. Click on the PHP / Apache tab.
  5. Click on the toggle switch On/Off as desired:
  6. Click on the Save button to validate the changes.

Has this FAQ been helpful?

This guide helps you download all the data related to your website hosted by Infomaniak.

 

Preamble

  • Automatic backups are made daily on Infomaniak installations.
  • However, you can download a clean and personal version of your website to keep it safe on your local installation, USB key, .zip archive on kDrive, etc.
  • To download a site created with WordPress, refer to this other guide specific to 2 extensions allowing local backup of information.
  • With the exception of Site Creator, the data of a website hosted by Infomaniak are accessible and visible on the server via an FTP connection (which means that to make a backup of the data, it is sufficient to download the content of the parent folder on the server).
  • All you have to do is add a backup of the site's database (which contains information that is not written in the files accessible by FTP).

 

Site location

When you arrive in the folder tree on the server, it will not always be easy to know where to go to download the information related to the site that interests you.

Start by noting the exact location of the site you want to download, by going to manager.infomaniak.com on the site's dashboard within your Web Hosting:

The indication highlighted above is the location of the example site. Check yours!

 

Connecting to the server

To get to the server, you need to use an FTP software/client or the Web FTP on the Manager which can be suitable in most cases:

 

Downloading the site

When you arrive on the Web FTP, you need to go to the location noted in the first chapter above, and click on the download icon to the right of the folder corresponding to your site:

 

The download starts and you get a .zip archive with all the files making up your website (with the exception of files starting with a "." like .htaccess).

 

Downloading the database

In most cases, your site uses a database to function. It must therefore also be downloaded.

To do this:

  1. Click on Databases in the left side menu.
  2. Click on the action menu ⋮ located to the right of the name of your database (if you are not sure which one to take, repeat the operation for each of them).
  3. Click on Download:

You will need to confirm the download (or export) of the most recent correct file in the next step to obtain a .sql.gz file that corresponds to all the tables in your database, which you should keep safe.

The download link is sent by email.


Has this FAQ been helpful?

To avoid the “Create a database: no privilege” error, it is imperative to go through the Manager Infomaniak and not through phpMyAdmin to add a new database.


Has this FAQ been helpful?

Git and GitHub are available at Infomaniak with all hosting offers on…

and of course the Jelastic Cloud offer, which will allow you to integrate versioning in depth.


Has this FAQ been helpful?

This guide provides tips that can help you optimize the search engine ranking of your site, such as Google.

 

Preamble

  • Infomaniak is one of the most powerful hosting providers in the French-speaking market, which contributes to the good ranking of your sites.
  • However, Infomaniak will not intervene on the content or development of hosted sites.

 

Natural referencing (SEO)

Natural referencing (Search Engine Optimization) is the optimization of a website to ensure that your site is visible in search engines based on certain keywords entered by users. The efforts you invest in SEO will have a long-term impact.

Some technical tips to optimize your natural referencing:

For more information, refer to the Infomaniak guide on natural referencing.

Google has also updated its guide "Getting started with natural referencing (SEO)" in 2024, with new fundamental "best practices" to optimize your visibility on the search engine.

 

Paid referencing (SEA)

Paid referencing (Search Engine Advertising) is the purchase of sponsored links in advertising spaces with the aim of quickly positioning your site on specific keywords. The goal is to place the best bid on keywords with good targeting to have the best chance of being visible at the best cost. The efforts you invest in SEA will cease to have a direct impact as soon as you stop your advertising campaigns.


Has this FAQ been helpful?

This guide covers the database management features available with Infomaniak hosting.

 

Discover also the high availability managed database solution (DBaaS) hosted in Switzerland, allowing you to easily deploy performant and secure clusters (MySQL, MariaDB, PostgreSQL) without having to manage the underlying infrastructure.

 

MySQL, SQLite, MariaDB, PostgreSQL…

At the Database Management System, hosting supports…

  1. … MySQL databases via PHP MySQL access or via Perl DBI+DBD::mysql
    • You can use MySQL as a database management system (DBMS) on Infomaniak servers.
    • You can access it either via PHP using the built-in MySQL database functions, or via Perl using the DBI and DBD::mysql modules
  2. … MySQLI, the native MySQL access interface (PHP5)
    • MySQLI is a PHP extension that allows access to a MySQL database.
    • It is an improved and more recent version of the old MySQL extension of PHP, offering enhanced features and performance.
  3. … SQLite 3.x
    • SQLite is a lightweight, standalone, and serverless SQL database engine.
    • Infomaniak servers support SQLite version 3.x, which means you can use SQLite to store data on these servers.
  4. … MariaDB
    • MariaDB is a fork of MySQL and is often used as an alternative to MySQL
    • You can therefore use MariaDB as a database management system on Infomaniak servers
  5. … the PGSQL module
    • PGSQL is a PHP module that allows you to connect to a PostgreSQL database
    • This specific feature allows you to connect to a REMOTE PostgreSQL database via PHP; this requires opening the appropriate port to the specific IP of the PostgreSQL database from the Infomaniak manager.

Dba, dbm, db2, sqlite are not supported, SQL Server neither (it is a database server that requires a Microsoft architecture).


Has this FAQ been helpful?

This guide details the file transfer protocols accepted on Infomaniak's Web Hosting and Cloud Server when connecting to ProFTPD servers.

 

Preamble

  • With a Starter hosting (basic web page), only an FTP connection on port 21 (without SSL/TLS) is possible.
  • When creating a website via Apache / PHP hosting, file access is possible via different protocols (FTP, SFTP, SSH).
  • With a Node.js site, only SSH / SFTP are possible to access your environment.

 

FTP (File Transfer Protocol)

FTP connections in "active" and "passive" modes are supported (switch between the two to try to resolve any potential issues).

Infomaniak opens the passive ports on its side [PassivePorts 42000 44000] but only for connections to its FTP server. The passive FTP mode involves the use of remote ports defined by the remote server, as well as local ports that can vary depending on the FTP software/client used.

Passive mode is primarily useful when the FTP software/client is behind a firewall or NAT router that blocks active FTP connections. However, in the Infomaniak infrastructure, active FTP connections are allowed, which means that using passive mode is generally not necessary.

Regarding PHP, it is not possible, by default, to manage this configuration in a centralized manner. Therefore, it is not viable for Infomaniak to open all ports to support all remote configurations, as this would be neither practical nor secure.

Overall, the infrastructure does not fully support outgoing passive mode FTP connections. For a smoother file transfer experience, it is recommended to use active FTP mode or explore more modern technologies such as SFTP (see below).

 

SFTP (SSH File Transfer Protocol)

Creating SFTP connections ensures high security for file transfers. Make sure you have enabled SSH on your SFTP software/client and use port 22 for the connection: sftp://*****.

 

FTPES (Secure FTP with TLS/SSL)

Use FTPES for secure file transfers with port 21 and SSL/TLS encryption. With the Filezilla software, for example, select "Explicit FTP over TLS" to configure your FTPES software/client: ftpes://*****.

 

FTPaccess

Access to the FTPaccess configuration is available.

 

What is not supported

Public/Anonymous User

It is not allowed to connect as a public or anonymous user. You must have a valid user account to access your hosting space.

FTPs (Secure FTP on a custom port)

The FTPs protocol is not supported, which means that port 2121 is not open for this type of connection.


Has this FAQ been helpful?

This guide explains how to obtain information about the presence of a caching system on a website using the curl command.

 

Preamble

  • In the world of programming and system administration, it is often necessary to determine if a website uses a caching system to improve its performance.
  • Caching systems like Fastly are commonly used to temporarily store data to serve it faster to users.
  • By following these steps, you will be able to determine if a website uses a caching system to improve its performance and understand the operation and optimization of websites.

 

Using the curl command

curl is a command-line tool for transferring data using URLs.

The -svo /dev/null option is used to perform a silent request (-s), display detailed information about the request (-v) and redirect the output data to /dev/null to ignore it (/dev/null is a special device on Unix/Linux systems that acts as a trash can). -H "Fastly-Debug: true" is an HTTP header added to the request to request specific Fastly debugging information.

 

Execute the command

Run the following command from a Terminal type application (command-line interface, CLI / Command Line Interface) on your device:

curl -svo /dev/null [url] -H “Fastly-Debug: true”

and replace [url] with the address of the website you want to check.

If the site uses Fastly or another similar caching system, you will see specific debugging information in the command output. The details provided may include information about HTTP requests and responses, as well as information about the cache and performance.


Has this FAQ been helpful?

This guide explains how to configure URL rewrites on your hosting. The Apache "mod_rewrite" module is enabled by default on all Infomaniak infrastructures.

 

Management via the .htaccess file

For security and stability reasons, Infomaniak does not allow direct modification of the server configuration (VirtualHost).

Any customization must be done via a .htaccess file placed at the root of your site.

In a .htaccess file, the regular expressions of your rewrite rules should not start with a slash (/).

  

Correct syntax

Example: you should use RewriteRule ^contact$ contact.php (instead of RewriteRule ^/contact$ contact.php)…

It is recommended to add the directive RewriteBase / right after enabling the engine (RewriteEngine On) to ensure the compatibility of your relative paths.


Has this FAQ been helpful?

This guide explains which protocols and ports can be used with Infomaniak's messaging services (including the Service Mail service).

 

Recommended ports and parameters for client configuration

When prompted during a software/messaging client configuration (Outlook, Thunderbird, mobile, etc.), prioritize the following parameters:

 IMAPs - Incoming Traffic (Recommended)SMTP - Outgoing Traffic (Option 1: IETF standard)SMTPs - Outgoing Traffic (Option 2: Implicit Encryption)
Ports993587465
Security MechanismSSL / TLS (implicit)STARTTLS (explicit)SSL / TLS (implicit)
Server Namemail.infomaniak.com
AuthenticationMandatory (username = full email address)

Technical Note: Port 587 with STARTTLS is the IETF standard practice for secure email submission. Port 465 is a secure alternative using implicit encryption.

If you specify other indications or disable encryption, email errors may occur.

 

Other supported ports (unencrypted or backward compatibility)

  • port 143 (Standard port for IMAP reception - unencrypted, use 993)
  • port 110 (Standard port for POP3 reception - unencrypted, use 995)
  • port 995 (Secure port for POP3s reception - secure POP3 option)
  • port 25 (Standard port for server-to-server transfer - may support STARTTLS for submission, but 587 is the standard for clients).
  • STARTTLS authentication is supported on unencrypted ports (143, 110, 25) to enable TLS encryption.
  • SMTP authentication supported (LOGIN or PLAIN methods).

 

API Usage and Transfer Security

The Infomaniak API does not offer any email connection as IMAP and SMTP are the "APIs". Use a library (such as Python: email.examples and imaplib) that uses IMAP and SMTP.

To display emails from PHP:
imap_open("{mail.infomaniak.com:993/imap/ssl}", $email, $password);

The MTA-STS mechanism is not implemented or verified, as Infomaniak uses DANE (DNS-based Authentication of Named Entities) to ensure an encrypted connection between servers when the following conditions are met:

  • The client sends an email to a domain that has configured DANE.
  • The client receives an email from an SMTP server that uses DANE.
  • In all other cases (in the absence of DANE), the encrypted connection remains opportunistic.

Has this FAQ been helpful?

This guide details the restrictions on the number of simultaneous connections allowed on MySQL databases for Web Hosting.

 

Simultaneous MySQL Connection Thresholds

To maintain server stability, security, and responsiveness for all users, the system enforces limits on simultaneous connections.

For each database user at Infomaniak, the limit is set to 38 simultaneous MySQL connections.

This quota prevents the saturation of shared resources. If this threshold is exceeded, access is temporarily blocked, and errors such as User has already more than 'max_user_connections' active connections or Too many connections may appear.

In practice, this threshold is rarely reached. If necessary, it is entirely possible to distribute the load by creating distinct MySQL users for the various scripts or services of your site.

 

No hourly connection quota

Infomaniak imposes no restrictions on the volume of queries per hour. Parameters such as MAX_QUERIES_PER_HOUR or MAX_CONNECTIONS_PER_HOUR are not enabled.

Unlike some competing offers, you will not encounter resource exhaustion errors of type SQL Error : 1226 related to hourly activity volume.

 

Learn more


Has this FAQ been helpful?

This technical guide details the resource limits on Infomaniak's web hostings; it is essential to distinguish real time (clock) from processing time (processor) to understand the origin of script interruptions.

 

1. MySQL connection time (I/O)

Limit: 30 real seconds

This limit corresponds to the absolute time elapsed "clock in hand". It concerns the communication between PHP and the database server (MySQL/MariaDB).

As soon as a connection is opened, the database server allocates a maximum of 30 seconds to receive the request, execute it, and return the results. If this deadline is exceeded (often due to a poorly optimized SQL query), the MySQL server abruptly cuts the connection. This usually generates the error MySQL server has gone away.

 

2. PHP processing time (CPU)

Limit: 10 CPU seconds

This limit concerns exclusively the computing power consumed by the web server to execute the PHP code.

It is crucial to note that waiting time does not count. When PHP waits for a response from the database, it is paused and consumes almost no CPU time. Consequently, a script will be interrupted by the web server only if it performs intensive calculations (complex loops, cryptography, file processing) for more than 10 cumulative seconds.

 

Interaction of the two limits

To ensure the stability of the application, each operation must simultaneously respect these two distinct constraints:

  • The application has 30 seconds of total time to interact with the database (network latency + SQL execution).
  • The application has 10 seconds of pure computing time to process the received data.

Example of valid operation: A script that waits 25 seconds for a complex response from MySQL (I/O) and then processes the result for 2 seconds (CPU) will work perfectly, as it has not exceeded either of the two individual quotas, even if the total time is 27 seconds.


Has this FAQ been helpful?

This guide explains how to force the display of the web hosting name in the browser's address bar to one of the domain names installed as an alias/synonym or how to display the main domain in the address bar instead of the alias.

 

Limiting the 'duplicate content' or duplicate content

Assume you have the hosting your-domain.com with Infomaniak and as a synonym domain name you have installed www.synodomain.xyz.

By default, when you type one or the other of the domain names (your-domain.com or synodomain.xyz) in the address bar of your browser, it is the one you typed that will be displayed in the address bar.

You therefore have the possibility to force the display of a different address than the one that was typed. Thus, if someone types synodomain.xyz, then it is your-domain.com that will automatically be displayed in the address bar.

A code must be entered in a file called .htaccess which must be located at the root of your hosting (in the /web folder of your FTP). If this file does not exist yet, you must create it on the server.

Insert the following directives in the file:

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://votre-domaine.com/$1 [R=301,L]

Adjust the code above according to these instructions:

  • Replace your-domain.com with your domain name with the appropriate extension (.com, .fr, .ch, etc.) that you want to see displayed in the visitor's browser address bar. Add www. before your-domain.com if necessary.
  • Replace the second line of the code above with "RewriteCond %{HTTPS} off‍" if a loop error occurs, this means that HTTP/2 is active for this site

Also, refer to the automatic redirections to httpS.


Has this FAQ been helpful?

This guide concerns the synchronization of servers via the NTP (Network Time Protocol) and the configuration of the timezone on Infomaniak servers.

 

Precise server synchronization via NTP

Infomaniak servers are all synchronized via the NTP protocol. The company provides its own public-accessible stratum-1 NTP servers for flexible use.

To integrate these servers into your settings, use the following entry: pool.ntp.infomaniak.ch.

The default timezone configuration is in UTC. However, PHP functions are designed to take into account different timezones depending on specific needs.

To adjust the timezone in your PHP scripts, use the function date_default_timezone_set('UTC').

 

MySQL: temporal specifics

The Infomaniak infrastructure supports features for working with temporal data accurately and efficiently, taking into account timezones, which is crucial for many modern applications:

  • MySQL uses a timezone database to store and manage timezone information.
  • The mysql.time_zone table contains timezone data, including time offset information, timezone names, etc.
  • The CONVERT_TZ function is used to convert a time from one timezone to another in MySQL with the following syntax: CONVERT_TZ(dt, from_tz, to_tz), where:
    • dt is the date/time to convert.
    • from_tz is the source timezone.
    • to_tz is the target timezone.
  • Example: CONVERT_TZ('2024-05-14 12:00:00', 'UTC', 'America/New_York') will convert the time 12:00:00 UTC to local time in New York.

Has this FAQ been helpful?