Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
This guide explains how to convert a free Web Starter offer to a more complete and enhanced paid offer, such as a Web Hosting shared or a Web Hosting on Cloud Server.
Preamble
- By purchasing a domain name from Infomaniak, you get 1 free email address as well as a basic Web space of 10 MB.
- In just a few clicks, it is possible to upgrade these offers to enjoy an enhanced experience.
Modify the Starter Offer - Basic Web Page
To upgrade this free offer:
- Click here to access the management of your product on the Infomaniak Manager (need help?).
- Click on the action menu â‹® located to the right of the relevant item.
- Click on Modify the offer:
- Follow the assistant to select the new type of hosting, pay to complete the offer change.
This guide explains why there is a folder /icons/
within the Web Hosting.
/icons/ folder on your Web Hosting
In some cases, a folder named /icons/
is present by default on your web hosting. This folder is generally accessible via HTTP, but is not visible in the FTP directory structure (www.domain.xyz/icons/
).
This directory /icons/
is often used to store specific icons or images used to display directory lists. These icons are generally used by web servers to visually represent the different types of files in directories when they are viewed through a browser.
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
All Infomaniak servers are 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 set to UTC. However, PHP functions are designed to accommodate different timezones according to specific needs.
To adjust the timezone in your PHP scripts, use the function date_default_timezone_set('UTC')
.
MySQL: time specifics
Infomaniak's infrastructure supports features for working with time data precisely and efficiently, taking into account time zones, which is crucial for many modern applications:
- MySQL uses a time zone database to store and manage time zone information.
- The table
mysql.time_zone
contains time zone data, including information about time offsets, time zone names, etc. - The function CONVERT_TZ 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.
This guide provides precise information on the support for the ASP
(Active Server Pages, aspx) development environment within the Infomaniak infrastructure.
ASP support
The Web hosting and Cloud Servers services are based on an Apache server architecture that does not natively support the Apache::ASP module.
However, it is possible to install and configure this ASP environment on VPS Cloud Infomaniak.
This guide explains how to add IP addresses to the whitelist of an Infomaniak Web site.
Preamble
- Allowing IP addresses on
xmlrpc.php
enables access to URLs that are blocked by default due to being considered risky. - This type of blocking is effective on all recent servers.
- Regarding WordPress, its XML-RPC feature is only available by default through Infomaniak services and JetPack for security reasons.
Add IP addresses to the xmlrpc.php whitelist
To access the website management:
- Click here to access the management of your product on the Infomaniak Manager (need help?).
- Click directly on the name assigned to the relevant product:
- Click on Manage under Advanced Settings:
- Click on the PHP / Apache tab.
- Complete the relevant line:
- Click the button to save.
This guide helps resolve an error of type "Invalid query: MySQL server has gone away
".
Preamble
- This type of error often occurs when a MySQL connection is kept open without submitting queries for a period of time beyond which the connection is closed: http://dev.mysql.com/doc/refman/5.7/en/gone-away.html
- The variables
wait_timeout
andinteractive_timeout
that control this disconnection are set to 30 seconds: http://dev.mysql.com/doc/refman/5.0/en/communication-errors.html
Solutions
To avoid the "MySQL server has gone away" error, here are several possible approaches:
Automatic verification and reconnection
Before executing a query, it is recommended to test if the MySQL connection is still active. If the connection has been closed, you can re-establish it automatically before proceeding with your query. Here is an example in PHP:
if (!mysqli_ping($connexion)) {
mysqli_close($connexion);
$connexion = mysqli_connect($host, $user, $password, $database);
}
The function mysqli_ping()
checks if the connection is still valid. If it is not, the script closes the connection and opens a new one.
Sending regular "Pings
Another method involves running a script that regularly sends a "ping" to the database to keep the connection active. For example, you could create a scheduled task (cron job) that sends a light query, such as SELECT 1;
at regular intervals.
Adjusting MySQL parameters (Cloud Server)
With a Cloud Server, you can increase the values of the variables wait_timeout
and interactive_timeout
from the MySQL menu of your server to extend the duration of the connection before it is closed.
This guide explains how to set up a WordPress network to manage multiple sites from a single WordPress installation, with URLs like site1.domain.xyz
, site2.domain.xyz
, or even domain1.com
, domain2.com
, etc.
Make your life easier! If needed, local partners recommended by Infomaniak can handle these procedures. Launch a free tender. They take care of everything, freeing you from technical details.
WordPress multisite installation
To begin:
- Install WordPress via Infomaniak on your hosting space with a main domain name:
- This first WordPress site must be reachable and function correctly:
- This first WordPress site must be reachable and function correctly:
- Log in via FTP.
- Edit the
wp-config.php
file of this first WordPress site concerned. - Above the line "
/* That's all, stop editing! Happy blogging. */
" (#94) copy and paste the codedefine('WP_ALLOW_MULTISITE', true);
:
- Save your changes.
- Then log in to the administration of your WordPress site.
- Temporarily disable all WordPress plugins:
- Go to the TOOLS menu to create a Network:
- Choose the method for creating your different WordPress sites (on subdomains)…
- Click on the installation button:
- Add the instructions displayed on the screen to the
wp-config.php
and.htaccess
on the server. - After reconnecting to your WordPress, you will get a new menu "My Sites" where you can add and manage your different sites on the same network:
- In the Manager, add an alias to your site in the form
*
.your-domain-here (the asterisk allows you to create a wildcard alias) with DNS update so that the correctCNAME
is automatically added to the zone: - Install or update your SSL certificates:
- When you create a new site within the network, by naming it for example
home2
it will become accessible viahome2.domain.xyz
and so on:
This guide is for you if you wish to perform vulnerability tests on your site/server hosted by Infomaniak.
Allowed and restricted
You are free to perform vulnerability tests (SQL injection, XSS, etc.), intrusion, or penetration testing (pentest) on your Infomaniak hosting only under the following conditions:
- … between 9 AM and 5 PM CET
- … from Monday to Friday
- … with the minimum number of attack packets regardless of the software used (AppScan for example)
- … without ever performing a single DoS or DDoS (Denial of Service) attack
- … while respecting the Infomaniak Terms of Service, particularly the shared service framework
Any abusive use may result in early termination by Infomaniak.
This guide explains how to solve a problem importing a .csv file into a MySQL table. The proposed alternative is to read the CSV file line by line using PHP and insert the data into the MySQL database.
"load data local infile" function disabled
The function LOAD DATA LOCAL INFILE
allows you to import a CSV file into a MySQL table and is unfortunately now frequently used by hackers to gain access to certain sites hosted on machines that accept this function.
To combat malicious acts and continue to protect clients' data as much as possible, Infomaniak has disabled the LOAD DATA LOCAL INFILE
function. This change does not affect users importing their CSV files (provided they do not check "CSV via LOAD DATA") via phpMyAdmin.
Here is an alternative to continue importing CSV formatted data into a MySQL table, a complete example (in French) of the code with proper error handling for opening the CSV file and inserting the data into the database.
This version uses mysqli
to connect to the database and prepared statements to insert the data, thus offering better security and compatibility with recent versions of PHP and ease of implementation in your PHP script or simply in a new PHP file in your /web directory:
$NomDuFichier = "data.csv";
// Connexion à la base de données MySQL avec mysqli
$link = new mysqli("localhost", "username", "password", "database");
// Vérification de la connexion
if ($link->connect_error) {
die("Échec de la connexion : " . $link->connect_error);
}
// Ouverture du fichier CSV en lecture
if (($handle = fopen($NomDuFichier, "r")) !== FALSE) {
// Décomposition de chaque ligne du fichier CSV
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
// Préparation de la requête SQL
$query = "INSERT INTO `test` VALUES (" . str_repeat('?,', count($data) - 1) . "?)";
$stmt = $link->prepare($query);
// Vérification de la préparation de la requête
if ($stmt === FALSE) {
die("Échec de la préparation de la requête : " . $link->error);
}
// Liaison des paramètres
$types = str_repeat('s', count($data)); // Assume que toutes les colonnes sont de type string
$stmt->bind_param($types, ...$data);
// Exécution de la requête
if (!$stmt->execute()) {
die("Échec de l'exécution de la requête : " . $stmt->error);
}
// Fermeture de la déclaration
$stmt->close();
}
// Fermeture du fichier CSV
fclose($handle);
} else {
echo "Erreur : impossible d'ouvrir le fichier.
";
exit(1);
}
// Fermeture de la connexion à la base de données
$link->close();
?>
Getting help
Unfortunately, it is impossible to precisely indicate where these lines of code should be added in your script.
If the proposed alternative causes issues when you submit multiple CSV files to read and the procedure, for example, ends without returning a message despite the error handling points in the PHP file, it is possible that the tables and fields used are not properly indexed. In this case, also contact your webmaster.
Refer to the PHP documentation regarding fgetcsv
.
Make your life easier! If needed, local partners recommended by Infomaniak can handle these tasks. Launch a free tender. They take care of everything, freeing you from the technical details.
This guide presents the DNS Diagnostic tool, which allows you to check that the relationships between…
- DOMAIN NAME at Infomaniak
and
- WEB HOSTING at Infomaniak
… are correct, so that Web traffic goes to the right place.
Introduction
- To check, the tool verifies the A, CNAME records, etc.
- You will thus be able to detect and correct certain web issues, especially if they are related to DNS (technical information that, broadly speaking, determines where such and such web traffic should be directed) by acting at the level of your domain.
- Automatic correction is only possible when the domain name is present in the same Organization as the product to which it must be attached.
- If this is not the case, then the correction will need to be done manually.
Diagnose a DNS issue
To access the DNS diagnostic for your domain name:
- Click here to access the management of your product on the Infomaniak Manager (need help?).
- Click directly on the name assigned to the product in question.
- Click on Web in the left sidebar.
- Click on DNS Diagnostic in the left sidebar:
- If DNS issues are detected, a red display on the table indicates this:
- Correct each error individually by clicking on the action menu ⋮ located to the right of the concerned element…
- … or all errors at once…
- … or, if necessary and you are sure, ignore these warnings.
- If DNS issues are detected, a red display on the table indicates this:
Refer to this other guide regarding the same automatic verification process but for Mail Services.
This guide concerns the homepage names that can be used on your Web Hosting Infomaniak, and which will be prioritized when a visitor accesses your website via its domain name.
Regarding Site Creator, refer to this other guide.
Preamble
- The default homepages on a web server are the first pages that display when a user accesses a website without specifying a particular file.
- If you simply enter
http://domain.xyz
in your browser's address bar, the web server will look for a default home page to display, for exampleindex.html
,index.php
,index.htm
, or other similar variations.
Homepage priority order
Here are the default pages loaded in order of priority at Infomaniak:
- index.html
- index.htm
- home.html
- home.htm
- default.html
- default.htm
- index.cgi
- index.php
- index.php5
- index.php4
- index.php3
- default.php
- home.php
- welcome.php
In summary:
- If you have 2 pages at the root of your hosting, thanks to the ranking above, you will notice that
index.php
is recognized as a priority overwelcome.php
. - It can also be deduced that if you only have
welcome.php
as a page in the root folder, it will be loaded and function as the homepage. - If you have a page
accueil.html
, it will not work because this name is not on the list. - When you type
www.domaine.xyz
into the browser, onlyindex.php
will automatically display (and to displaywelcome.php
you will need to type the exact page namewww.domaine.xyz/welcome.php
).
Customize the default homepage
To set a different default home page, add DirectoryIndex
followed by the appropriate pages in the .htaccess
file:
DirectoryIndex accueil.html index.php index.html
This means that the web server will first look for a file named accueil.html
. If it does not find accueil.php
, it will look for index.php
, then index.html
.
To avoid an error “Create a database: no privilege” you must go through the Manager Infomaniak and not through phpMyAdmin
to add a new database.
This guide explains how to obtain information about the presence of a cache system on a site 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 option -svo /dev/null
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 like a trash can). -H "Fastly-Debug: true"
is an HTTP header added to the request to request Fastly-specific debugging information.
Run 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.
This guide explains how to enable the MultiViews option via a .htaccess
file on sites hosted by Infomaniak.
Preamble
- In some cases, the MultiViews option must be enabled to handle redirection and URL rewriting issues. Example:
- If the
configuration
folder and theconfiguration.php
file are located at the root of your site and you try to access the addressmon-site.com/configuration
to reach theconfiguration.php
file, the MultiViews option must be enabled.
- If the
Enable the MultiViews option
To do this:
- Open or create the
.htaccess
file located at the root of the relevant site. Add the following directive:
Options +MultiViews
- Save the changes.
This guide concerns ImageMagick, a powerful solution for image manipulation, which you can install on a Web Hosting Infomaniak.
For installation, the easiest way is to use Fast installer.
ImageMagick and alternatives
These image manipulation solutions are compatible with Web Hosting and Cloud Servers:
ImageMagick
: the main software suite for versatile image manipulation via the command linePerlMagick
: Perl interface to integrate ImageMagick functionalities into Perl scripts- Perl Module
Image::Magick
: Perl extension to access ImageMagick features without specifying the absolute path of the executable GD 2.x
: open-source graphics library offering similar functionalities to ImageMagick, often used in web development contextsGallery 2
: an online image gallery management platform compatible with ImageMagick
If necessary, the path for ImageMagick is standard since it is installed through the Debian repository:
/usr/bin
and for the Perl module Image::Magick
:
/usr/local/bin/convert
or without specifying the absolute path:
$ perl -e 'use Image::Magick';
All ImageMagick commands are under /usr/bin/
:
/usr/bin/animate
/usr/bin/compare
/usr/bin/composite
/usr/bin/conjure
/usr/bin/convert
/usr/bin/display
/usr/bin/identify
/usr/bin/import
/usr/bin/mogrify
/usr/bin/montage
/usr/bin/stream
This guide details "502 Bad Gateway" errors that can occur when visiting a website.
Introduction
- The 502 Bad Gateway error occurs when the server acting as a gateway between the browser and the origin web server receives an invalid response.
- This error can be caused by an overloaded web server, communication issues between a CDN and the hosting web server, or a misconfigured proxy server.
- Sometimes, the error may be caused by a bad entry in the DNS server.
Troubleshooting steps
To resolve the 502 Bad Gateway error, you often need to troubleshoot by elimination:
- Check if the server is not temporarily overloaded: simply reload the page after a few minutes for the error to disappear.
- Clear the browser cache.
- Try using another browser.
This guide explains how to view file activity on the server of your hosting Infomaniak.
FTP activity logs
To find out about the activity of exchanges on your FTP space, contact Infomaniak support to request FTP logs by first authenticating with the credentials corresponding to the management of your web hosting.
Help reading logs: http://www.castaglia.org/proftpd/doc/xferlog.html
The owner "site1xxx
" (e.g. site1152
, site1163
, site1184
…) appears when the FTP user account that created the folders/files in question has been removed from the list of FTP user accounts.
To access these files again in order to modify them, you need to log in with a different FTP account in the FTP File Manager and change the owner of the files with the "Properties" button.
This guide explains how to optimize web resource caching using HTTP headers.
Introduction
- A good caching strategy significantly improves your site's performance by avoiding the unnecessary retransmission of unchanged files.
- Web caching relies on two complementary mechanisms:
- The cache validity duration (via the
Expires
header) which indicates how long a resource can be reused without contacting the server. - Conditional validation (via the
Last-Modified
/If-Modified-Since
headers) which allows checking if a resource has changed before re-downloading it.
- The cache validity duration (via the
Configuration of cache duration with Expires
The Expires
header allows you to specify a duration during which the browser can directly reuse resources from its local cache. Here's how to configure it in your .htaccess
file:
- Create or open the
.htaccess
file at the root of your site (usually in/web
or/sites/domain.xyz
). Add the configuration for the
expires
module:<IfModule mod_expires.c>
Set the appropriate cache durations for each type of resource:
ExpiresActive On ExpiresByType text/html "access plus 1 week" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType text/css "access plus 1 month" ExpiresByType application/javascript "access plus 1 month"
These directives mean that:
- HTML pages will be cached for one week.
- JPEG images, CSS files and JavaScript files will be kept for a month.
Adjust these durations according to the frequency of updates to your resources.
Close the configuration section:
</IfModule>
Conditional validation with Last-Modified
Even when a resource has expired in the cache, it is not always necessary to completely redownload it. The conditional validation mechanism allows the browser to check if its cached version is still up-to-date. This process works as follows:
- The server automatically sends a
Last-Modified
header with each resource, indicating its last modification date.- Apache handles this natively for static files - no additional configuration is required.
When the browser requests the resource again, it sends a
If-Modified-Since
header containing the date it has in cache:GET /resource HTTP/1.1 Host: www.example.com If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT
- The server compares this date with the actual file modification date:
- If the file has not changed, it simply returns a
304 Not Modified
code, thus saving bandwidth. - If the file has been modified, it returns the new version with a
200 OK
code.
- If the file has not changed, it simply returns a
This guide explains how to configure the PHP parameters of Web hostings directly from the command line when you run PHP scripts using PHP CLI (Command Line Interface).
Preamble
- This type of configuration can be useful when you need to temporarily modify certain parameters for a specific script or for a PHP session.
- These changes will only be valid for the current script execution and will not alter the global PHP configuration.
Modify the PHP CLI parameters
For example, to temporarily modify the parameters for a specific script without having to modify the configuration PHP of the server, follow the method below; with the PHP CLI environment you can specify multiple PHP parameters at the same time by separating them with spaces.
Using the parameter -d
When you run PHP from the command line, you can use the parameter -d
to specify PHP configurations. This allows you to modify the PHP parameters for that specific execution. For example, to set the maximum execution time to 90 seconds, the memory limit to 256 MB and disable secure mode, you can do it as follows:
php -d max_execution_time=90 -d memory_limit=256M -d safe_mode=Off -f test.php