Procédure
Welcome to this documentation dedicated to using the .user.ini file on hosting plans managed with the LWS Panel. We will explain how to create and configure the .user.ini file, its usefulness, and its role in optimizing your website. The goal? To help you master this tool to make your online presence a success. Let's get started right away.
The .user.ini file is an essential element of the configuration of your website hosted on LWS Panel. More specifically, it is a PHP-specific configuration file. This file allows you to customize and adjust PHP settings for your specific website. The settings in this file control various aspects of your site, including the default character set used, the number of input variables contained in the "cookies", and much more. In short, the .user.ini file offers additional flexibility to fine-tune the behavior of your site.
Creating a .user.ini file is a relatively simple process, but it requires access to your website's storage space. To do this, go to the file manager. Once in the file manager, you will need to create a new file. Name this file '.user.ini' (the dot at the beginning is very important in the file name) and place it in the root of your site. You can then open this file directly with the FileManager and start adding the configuration directives of your choice.
The directives are listed in the file one below the other without any priority order and in the form:
designation_directive = "directive_value"
Don't forget to save your changes before closing the file.
Using the user.ini file is particularly useful when you want to modify PHP settings that are not directly accessible via the LWS Panel interface. For example, you may encounter a situation where you need to change the default character set for an interpretation of special characters used in your project. In such cases, the .user.ini file can be an indispensable tool. However, it should be noted that changes made to this file must always be carried out with care, as they can have a significant impact on how your site works.
It is crucial to remember that not all directives are allowed in the user.ini file. For security and server stability reasons, some directives cannot be defined in this file. Before adding a directive to your user.ini file, be sure to consult the official PHP documentation to confirm that it is allowed. This is an essential step to preserve the integrity of your site and avoid unexpected problems.
You can find all the directives that can be used in a user.ini file in this official PHP documentation.
Exclusions:
For security and server stability reasons, some directives cannot be defined in this file. Here is the list of excluded directives:
| All PHP_INI_SYSTEM directives | These directives can only be modified in the php.ini or httpd.conf files to which the user has no access |
| sendmail_path | blocked for security reasons |
| sendmail_from | blocked for security reasons |
| error_log | blocked for security reasons |
| mail.log | blocked for security reasons |
| upload_tmp_dir | blocked for security reasons |
| session.save_path | blocked for security reasons |
| memory_limit | Can be modified directly in the PHP configuration on LWS Panel |
| post_max_size | Can be modified directly in the PHP configuration on LWS Panel |
| upload_max_filesize | Can be modified directly in the PHP configuration on LWS Panel |
| max_execution_time | Can be modified directly in the PHP configuration on LWS Panel |
| max_file_uploads | Can be modified directly in the PHP configuration on LWS Panel |
| open_basedir | blocked for security reasons |
| default_socket_timeout | blocked for security reasons |
defaut_charset
"UTF-8" is the default value and is used as the default character set for functions and modules. PHP will always send a default character set for htmlentities(), html_entity_decode() and htmlspecialchars() if the encoding parameter is omitted. The value of default_charset will also be used to set the default character set for iconv functions if the configuration options iconv.input_encoding, iconv.output_encoding and iconv.internal_encoding are not set, and for mbstring functions if the configuration options mbstring.http_input, mbstring.http_output and mbstring.internal_encoding are not set.
All PHP versions will use this value as the default character set in the default Content-Type header sent by PHP if the header is not overridden via a call to the header() function.
max_input_var
The number of input variables that can be accepted (this limit is applied separately to the superglobal variables $_GET, $_POST and $_COOKIE). Using this directive helps limit the possibilities of denial-of-service attacks using hash collisions. If there are more input variables than the number specified by this directive, an E_WARNING warning will be issued, and the extra variables will be removed from the request.
auto_prepend_file and auto_append_file
allows forcing the loading of a file before or after a php file. For example, instead of doing on all files, just do auto_prepend_file = header.php to load it.
Wordfence uses it in particular to load its firewall script before WordPress.
opcache.enable
Setting this variable to "0" makes it possible to temporarily disable OPCache compilation caching, which is useful for tests and debugging
display_errors
to display errors in browsers
error_reporting
selects the types of errors to display (all, all except notices, all errors and warnings only, all except deprecated, ...)
short_open_tag
allows or forbids short tags ( to mean
Effective use of the .user.ini file requires some knowledge and special attention. Here are a few tips to help you get the most out of this tool. First, always test your changes in a development environment before applying them to your production site. This will allow you to identify and fix any problems without disrupting your live site. Second, if your site starts to encounter problems after a change to the user.ini file, that change is likely the cause. In this case, roll back and review your changes to identify the problem.
Consult this full help article detailing all the features of our web hosting plans (LWS Panel): Help on the quotas and features of web hosting plans (LWS Panel).
Congratulations! You now have a deeper understanding of how to use the user.ini file with LWS Panel. This guide has provided you with valuable information on creating, configuring, and optimally using this file, allowing you to improve your site's performance and security. The .user.ini file is an extremely powerful tool at your disposal, but like all powerful tools, it must be used with care. Continue exploring, learning, and optimizing. Your journey into the world of the web with LWS is just beginning.
Ask the LWS team and the community. Answers are published after moderation.