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 site 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. PHP directives can be customized with a .user.ini
file, which will be effective in the folder and subfolders where the .user.ini
file is located.
Modify the server configuration of a site
via the Manager
To modify the PHP configuration and most parameters (max_input_vars
, allow_url_fopen
, memory_limit
, post_max_size + upload_max_filesize
, etc.):
- log in to the Infomaniak Manager (manager.infomaniak.com) from a web browser such as Brave or Firefox
- click on the icon in the top right corner of the interface (or navigate using the left side menu, for example)
- choose Website (in the Web & Domain universe)
- click on the name of the relevant object in the displayed table
- click on the Advanced settings button
- click on the PHP or Apache tab to make the desired adjustments
via the .user.ini file
For PHP directives that are not available 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 is available on the official PHP website, but items marked as PHP_INI_SYSTEM
in the Modifiable
column, as well as max_input_time
, memory_limit
, and mysqli.default_socket
, cannot be used.
via CLI
To customize PHP directives when running command-line scripts (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 with the -c option followed by the path to the .user.ini file is used. For example, to change the available memory limit for PHP to 1024M, you can create or edit 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 to the .user.ini file. Then, when running a PHP script on the 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 is used to set a PHP configuration directive (allow_url_fopen
) with the valueOn
~/bin/wp
: path to the WP CLI executablepackage install trepmal/wp-revisions-cli
: the specific command to install the 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 certain operations involving opening remote URLs, such as downloading extensions or packages. Make sure this option is enabled securely and following security best practices.