Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
This guide explains how to change the PHP version available for the websites on your Infomaniak Web Hosting.
It is possible to switch from an old and potentially vulnerable PHP version to a newer one, but reverting back to this vulnerable version will no longer be possible for security reasons.
Change the PHP version used for a website
You can easily change the PHP version used on an entire website:
- Log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Edge
- Click on the icon at the top right of the interface (or navigate through the left side menu, for example)
- Choose Website (Web & Domain universe)
- Click on the name of the relevant object in the displayed table
- Click on Edit in the PHP version section
- Choose the desired PHP version
- Click Save to save the change
The change takes effect immediately and permanently.
To configure the PHP version used in SSH, read this guide.
This guide explains how to redirect a domain name directly to another or how to automatically send visitors from your website to another page address (internal or external URL).
You will need to take action either on the domain name itself (it must be hosted by Infomaniak, and its DNS must also be those of Infomaniak), or on the code present in your pages (htaccess page, homepage, etc.) if you have a website.
⚠️ For additional help, contact a partner or submit a request for proposal — also read the role of the host
Acting on the Domain Name
via Web Redirection Tool
The tool available in the Manager allows you to easily act on the domain name (or subdomain) to redirect it to the Internet address of your choice.
via DNS changes or A record
Change the DNS of the domain name or modify its A/AAAA records to direct web traffic to another provider.
Acting on the Code of the Pages
via HTML code to insert
Insert this line of code between the <head>
and </head>
tags of your homepage (usually named index.html):
<meta http-equiv="refresh" content="5;url=INSERT-HERE-NEW-URL">
Replace 5 with the desired waiting time in seconds (0 for an immediate effect).
Google search engine suggests using a server-side 301 redirect (see below). The W3C also advises against using it.
via PHP code to insert
If the site page has a .php extension, insert this function call at the top of the file:
header("refresh: 5; url=INSERT-HERE-NEW-PAGE-URL");
via .htaccess file
To redirect all traffic to your site (regardless of the called page) to another address, insert this in the .htaccess file at the root of your site:
RewriteEngine On
RewriteRule ^(.*)$ INSERT-HERE-NEW-URL/$1 [R=301]
To target the page that needs to be redirected:
Redirect permanent /old_page.html insert destination URL here
Redirectpermanent, Redirect permanent, and Redirect 301 are equivalent commands.
Here is another example of redirecting a subpart to the homepage (this directive works with "deep links" unlike a permanent redirect):
RewriteEngine on
RewriteRule "old/path/url "/" [L]
This guide explains how to modify the PHP version directly via command line when running PHP scripts using PHP CLI (Command Line Interface). This can be useful when you need to temporarily modify certain settings for a specific script or PHP session.
Modify the PHP Version Used in CLI
To change the PHP version used in command line (CLI) via SSH:
- Connect via SSH (help)
- Create a
.profile
file if it doesn't exist: touch ~/.profile - Edit the
.profile
file: nano ~/.profile - Add this code inside the file to choose the desired PHP version: export PATH=/opt/php7.4/bin:$PATH
- Load the
.profile
file: source ~/.profile - Verify the PHP version: php -v
Interactive Mode
The .profile
file mentioned above is only loaded when the user interface is used. In SSH (login mode), it's the .bash_profile
file that is sourced. And in interactive mode (non-login), it's the .bashrc
file that is sourced.
Some server deployment scripts open sessions in interactive mode (non-login), and environment variables are not loaded into the PATH even if the SSH session is correctly configured.
In this case, you need to load the PHP version into the .bashrc
file (export PATH="/opt/php7.4/bin:$PATH"
), and source the .bashrc
file in the .bash_profile
and .profile
files (. ~/.bashrc
).
After following these steps, the PHP version you specified should be loaded into your shell environment whenever you open a new session. This will allow you to run scripts using this PHP version in command line (CLI).
Mention of PHP Version
If you only use the mention php
, the release preceding the one that was already in place will be installed (latest version -1): if the latest installed version is 8.1, it's 8.0 that will be used with "php". It's preferable to use the mention php-7.0
, php-7.1
, etc. so that the version doesn't change with each update.
This guide explains how to transfer data (Web, Mail, Domain, and even Cloud) currently hosted elsewhere to Infomaniak. You remain, of course, the owner of your data, without loss or interruption!
Don't have time to migrate your services? Launch a free tender to find an Infomaniak partner who will handle everything.
Specific Guides
Click on the link corresponding to your current hosting provider:
- Swisscom: complete guide to migrate Web, Mail, and domain name data
Guides for any other host
To retrieve all other data, follow the procedures below:
- guide to migrate Web data (any PHP, HTML, etc. site - for WordPress read this guide)
- guide to migrate Mail data (email addresses, mailbox content, etc.)
- guide to transfer the domain name (domain management, DNS zone, etc.)
To avoid interrupting your website and emails and prevent any content loss when importing your existing data, migrate your services in the indicated order.
You can also bring over other types of data onto Infomaniak servers:
- content from Dropbox, Google Drive, etc.: read this guide
- data from Synology or QNAP NAS: read this guide
Why join Infomaniak?
By consolidating your domain names, websites, and email addresses with Infomaniak, you simplify the management of your invoices and services. Moreover, the linking of your domains will be done automatically with your site and email address. You will not need to manually configure the DNS of your domains with another registrar.
Learn more about Infomaniak
This guide explains how to configure PHP settings directly from the command line when running PHP scripts using PHP CLI (Command Line Interface). This can be useful when you need to temporarily modify certain settings for a specific script or PHP session.
Modifying PHP CLI Settings
To, for example, temporarily modify settings for a specific script without having to modify the global PHP configuration of the server, follow the method below; with the PHP CLI environment, you can specify multiple PHP settings at once by separating them with spaces.
Using the -d
parameter
When running PHP from the command line, you can use the -d
parameter to specify PHP configurations. This allows you to modify PHP settings for this specific execution. For example, to set the maximum execution time to 90 seconds, memory limit to 256 MB, and disable safe mode, you can do it as follows:
php -d max_execution_time=90 -d memory_limit=256M -d safe_mode=Off -f test.php
This guide explains how to activate PHP-FPM status to, for example, debug a slow PHP website.
PHP-FPM status allows you to monitor in real-time the scripts that are executed as well as their execution time. This operation is only possible on a Cloud Server.
Activating PHP-FPM status
To activate PHP-FPM on a site, contact Infomaniak support from an email address associated with your user account to authenticate your request.
In your request, please indicate the source IP address that needs to be authorized.
Once PHP-FPM status is activated, the following URL links will display the necessary information:
- https://domain.xyz/fpm-status?json&full
- https://domain.xyz/fpm-status?html&full
- https://domain.xyz/fpm-status?xml&full
Attention: If your site contains rewrite rules that include the path /fpm-status, you will likely need to make an exception for it.
This guide explains how to install PHP extensions, such as a cache system, on Managed Cloud Server with just a few clicks. Other technologies can be installed (click here).
Install (or uninstall) PHP extensions
To find the list of extensions and proceed with their installation:
- Log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Firefox
- Click on the icon at the top right of the interface (or navigate using the left side menu, for example)
- Choose Managed Cloud Server (under Web & Domain universe)
- Click on the name of the relevant object in the displayed table
- Click on PHP Extensions in the left side menu
- Click on the action menu ⋮ on the right of the extension you want to uninstall in the displayed table
- Click on Uninstall
- Otherwise, click on the blue button Install an extension to make your choice
Non-exhaustive list of available extensions
- Memcached
- PHP_APCu
- PHP_CLI
- PHP_FPM
- PHP_GnuPG
- PHP_gRPC
- PHP_igbinary
- PHP_IonCube
- PHP_OPcache
- PHP_PDF
- PHP_PDO_ODBC
- PHP_Swoole
- Redis
This guide explains how to enable support for certain types of files (.inc
for example) by PHP on an Infomaniak Web hosting so that they are processed in the same way as a .php
file.
Extensions recognized by PHP
Previously, you had to add the following line to a .htaccess
file:
AddType application/x-httpd-php .inc
This prevented the file's content from being displayed as text instead of being correctly interpreted by PHP when accessed via a browser.
Now you can manage file extensions via the FPM Extensions field in your hosting Manager.
To add support for a specific file type:
- Log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Firefox
- Click on the icon at the top right of the interface (or navigate using the left sidebar menu, for example)
- Choose Hosting (Web & Domain universe)
- Directly click on the name of the relevant item in the displayed table
- Click on the name of the relevant site (in the Sites section)
- Click on the Advanced settings button
- Click on the Apache tab
- You will find the FPM Extensions field where you can add the desired extension
This guide explains why it's dangerous to use a version of PHP that is no longer officially maintained and how to use a newer version of PHP with a website hosted by Infomaniak.
Is Using an Outdated Version of PHP Dangerous?
When you use a (soon to be) vulnerable version of PHP on one or more of your sites, a warning message appears in the dashboard of the affected hostings.
The PHP language evolves regularly and when you use a version of PHP that is no longer maintained, you expose your website to security risks. Malicious individuals could, for example, exploit known security vulnerabilities to break into your site and alter its content. It is therefore strongly recommended to always use a recent version of PHP.
There are 3 possible statuses:
- the PHP version is fully supported: no action is required
- the PHP version only receives security updates: it is recommended to use a more recent version of PHP
- the PHP version is no longer maintained: it is strongly recommended to use a more recent version of PHP
Learn more: http://php.net/supported-versions.php
Using a More Recent Version
The latest versions of PHP are more efficient and speed up the loading of websites.
Before using a more recent version of PHP, the following precautions should be taken:
- if your site operates with a CMS or a web application (WordPress, Joomla, Drupal, etc.), it is recommended to check that its current version is compatible with the version of PHP you plan to use
- if your site was developed by hand, it's necessary to consult the official PHP documentation in order to be aware of modified functions and possible incompatibilities
If you encounter problems after migrating a site to a newer version of PHP, it may be possible to revert to a previous version of PHP if it is still supported.
This guide details sending emails from a website hosted by Infomaniak using the PHP function mail() function, which is disabled by default.
Infomaniak strongly advises against using the PHP mail() function for sending emails from your applications:
- Emails will be considered "unauthenticated" and therefore subject to limits
- Their deliverability will be impacted, which can harm your website
Specify the sending address
To ensure that messages are sent correctly from your CMS/web application (and avoid an error like Could not instantiate mail function
or sender mismatch
), it is necessary to specify a valid address in the site settings on the Infomaniak side:
- Login to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Firefox
- Click on the icon at the top right of the interface (or navigate through the left side menu, for example)
- Choose Hosting (Web & Domain universe)
- Click directly on the name of the relevant object in the displayed table
- Click on the name of the relevant site (in the Sites section)
- Click on the Advanced Settings button
- Enter an existing email address in the Sender Email field
- Click the blue Save button
Re-enable the mail function
If you still wish to use the PHP mail function, you will need to re-enable it on each of the sites in your Web Hosting account:
- Login to the Infomaniak Manager (manager.infomaniak.com) from a web browser like Brave or Firefox
- Click on the icon at the top right of the interface (or navigate through the left side menu, for example)
- Choose Hosting (Web & Domain universe)
- Click directly on the name of the relevant object in the displayed table
- Click on the name of the relevant site (in the Sites section)
- Click on the Advanced Settings button
- Click on the PHP tab
- Enable the mail function
- Click Save
PHP mail() Example
WordPress
Configure the sending of the default contact form included with Divi Builder:
- Login to the WordPress admin panel
- Go to the Divi editor of the page containing the contact form
- Click on the gear icon to set up the Divi contact form
- Under EMAIL, enter the email address that will receive the form submissions and save
- By default, when a visitor uses the form to contact you, you will receive an email from
mail@your-site-name
, and if you reply, the recipient will automatically be the email address provided by the visitor when filling out the contact form
Joomla
Configure email sending via PHPmail (not recommended) in Joomla:
- Login to your Joomla site's administration panel
- Go to Configuration then Server
- DO NOT enter anything in the Site Email field
Unfortunately, this prevents any sending test via the button for this purpose, but it will work if you set up a contact form on your site. Click Save once the box is left empty.
Reply-to Address for PHP mail()
When sending an email with the PHP mail() function, the return-path
will be in the form root@h2web3.infomaniak.ch
, for example. However, the Reply-To:
header in your form code allows you to specify a valid reply address.