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 Web Hosting Infomaniak.
Preamble
- Apache is the HTTP server.
- It is configured with a
.htaccess
file placed at the root of the website.
- It is configured with a
- 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.
- It is possible to customize PHP directives with a
- Refer to this other guide regarding the creation of .htaccess / .user.ini files.
Modify the server configuration of a site…
... via the Manager
To modify the PHP configuration and most of the parameters (max_input_vars
, allow_url_fopen
, memory_limit
, post_max_size + upload_max_filesize
, etc.):
- 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 different tabs General, PHP / Apache and PHP Extensions to make the desired adjustments:
Do not forget to save the changes at the bottom of the page.
Refer to this other guide if you are looking for information about limit values and the possibilities of unlocking them.
... via the .user.ini file
For the PHP directives that are not available in the Manager, it is necessary to set 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 the elements with the indication PHP_INI_SYSTEM
in the Modifiable
column as well as max_input_time
, memory_limit
and mysqli.default_socket
are not usable.
... in CLI
To customize PHP directives when running scripts via command line (CLI) or in CRON jobs, it is necessary to specify the desired values in a .user.ini
file.
Next, to apply these configurations, the PHP executable is used with the option -c
followed by the path to the .user.ini
file.
For example, to modify the memory limit available 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 directive memory_limit with the value 1024M in the file .user.ini
.
Then, when running a PHP script via command line or in a CRON job, the PHP command with the -c
option will be used to specify the .user.ini
file containing the custom configurations.
The following example enables allow_url_fopen
for the WP CLI tool (which notably 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 option-d
allows 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 option allow_url_fopen
is enabled during the execution of the specified WP CLI command. Enabling allow_url_fopen
may be necessary for certain operations that involve opening remote URLs, such as downloading extensions or packages. Make sure this option is enabled securely and in accordance with best security practices.