1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Modify the server configuration of a website
This guide explains how to modify the server configuration of a website on Infomaniak Web Hosting.
.htaccess or .user.ini File?
Apache is the HTTP server. It is configured with a .htaccess
file placed at the root of the website.
PHP is a programming language used to create dynamic web pages via an HTTP server. It is possible to customize PHP directives with a .user.ini
file, which will be effective in the folders and subfolders of the location of the .user.ini file.
Modifying a Website's Server Configuration
via the Manager
To modify the PHP configuration and most settings (max_input_vars, allow_url_fopen, memory_limit, etc.):
- 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 through the left sidebar menu, for example)
- Choose Website (universe Web & Domain)
- Click on the name of the relevant object in the displayed table
- Click on the Advanced Settings
- Click on the PHP or Apache tab to make the desired adjustments
via the .user.ini file
For PHP directives not present in the Manager, it is necessary to define the desired values in the .user.ini
file, for example:
max_file_uploads = 20
The list of existing directives can be found on the official PHP website, but items with PHP_INI_SYSTEM
indication in the Modifiable
column as well as max_input_time
, memory_limit
, and mysqli.default_socket
are not usable.
via CLI
To customize PHP directives when executing scripts in command-line (CLI) or in CRON tasks, it is necessary to specify the desired values in a .user.ini file. Then, to apply these configurations, the PHP executable is used with the -c option followed by the path to the .user.ini
file. For example, to modify the available memory limit for PHP to 1024M, you can create or modify the .user.ini file using the following command:
echo 'memory_limit = 1024M' > .user.ini
This command writes the memory_limit directive with the value 1024M into the .user.ini
file. Then, when executing a PHP script in command-line or in a CRON task, the PHP command with the -c
option is used to specify the .user.ini
file containing the customized configurations.
The following example enables allow_url_fopen
for the WP CLI tool (allows retrieving extensions):
php -d allow_url_fopen=On ~/bin/wp package install trepmal/wp-revisions-cli
php
: the PHP executable-d allow_url_fopen=On
: the-d
option sets a PHP configuration directive (allow_url_fopen
) toOn
~/bin/wp
: path to the WP CLI executablepackage install trepmal/wp-revisions-cli
: the specific command to install WP CLI packagetrepmal/wp-revisions-cli
This ensures that the allow_url_fopen
option is enabled during the execution of the specified WP CLI command. Enabling allow_url_fopen
may be necessary for some operations involving opening remote URLs, such as downloading extensions or packages. Make sure this option is enabled securely and in accordance with security best practices.