1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Change the server configuration of a website
This guide explains how to change the server configuration of a site on Web hosting Infomaniak.
Preamble
- Apache is the HTTP server.
- It configures with a file
.htaccess
placed at the root of the website.
- It configures with a file
- PHP is a programming language used to create dynamic web pages via an HTTP server.
- It is possible to customize PHP directives with a file
.user.ini
which will be effective in folders and subfolders of file location .user.ini.
- It is possible to customize PHP directives with a file
- Be aware of this other guide about creating files .htaccess/.user.ini.
Edit the server configuration of a site...
... through the Manager
To change PHP configuration and most settings (max_input_vars
, allow_url_fopen
, memory_limit
, post_max_size + upload_max_filesize
, etc.):
- Click here in order to access the management of your product on the Manager Infomaniak (Need help?).
- Click directly on the nameallocated to the product concerned.
- Click on Manage under Advanced Parameters:
- Click on the various 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.
Be aware of this other guide if you are looking for information about limit values and opportunities for release of the latter.
... through the file .user.ini
For PHP directives who are not present on the Manager side, it is necessary to define the desired values in the file .user.ini
e.g.:
max_file_uploads = 20
The list of existing directives can be found on the PHP official website but the elements with the indication PHP_INI_SYSTEM
in the column Modifiable
and max_input_time
, memory_limit
and mysqli.default_socket
are not usable.
... in CLI
To customize PHP directives when executing command line scripts (CLI) or CRON tasks, it is necessary to specify the desired values in a file.user.ini
.
Then, to apply these configurations, the PHP executable is used with the option -c
track path to file .user.ini
.
P.ex to change the memory limit available for PHP at 1024M, you can create or modify the file .user.ini
using the following command:
echo 'memory_limit = 1024M' > .user.ini
This command writes the memory_limit directive with the value 1024M in the file .user.ini
.
Then, when running a PHP script on the command line or in a CRON task, the PHP command will be used with the option -c
to specify the file .user.ini
containing custom configurations.
The following example is active allow_url_fopen
for the WP CLI tool (including the ability to recover extensions):
php -d allow_url_fopen=On ~/bin/wp package install trepmal/wp-revisions-cli
php
: PHP executable-d allow_url_fopen=On
: the option-d
allows you to define a PHP configuration directive (allow_url_fopen
) with the valueOn
~/bin/wp
: path to the executable WP CLIpackage 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 activated during the execution of the specified WP CLI command. Activation of allow_url_fopen
may be necessary for some operations that involve opening remote URLs, such as downloading extensions or packages. Make sure that this option is enabled in a secure manner and in accordance with best security practices.