Procédure
Welcome to this documentation dedicated to using the .user.ini file on hosting plans managed with the LWS Panel. We will detail 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 your website configuration 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 "cookies", and much more. In short, the .user.ini file offers additional flexibility to fine-tune your site's behavior.
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 leading dot is very important in the file name) and place it at 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, in no particular order, in the form:
directive_name = "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 interpreting 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 done carefully, 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 issues.
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, which the user cannot 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 the LWS Panel |
| post_max_size | Not modifiable: value set by LWS, displayed (grayed-out field "Post_max_size") in the "General PHP configuration" tab of the PHP configuration in the LWS Panel |
| upload_max_filesize | Not modifiable: value set by LWS, displayed (grayed-out field "Max_upload_size") in the "General PHP configuration" tab of the PHP configuration in the LWS Panel. To upload a larger file to your hosting, use FTP. |
| max_execution_time | Can be modified directly in the PHP configuration on the LWS Panel |
| max_file_uploads | Can be modified directly in the PHP configuration on the LWS Panel |
| open_basedir | blocked for security reasons |
| default_socket_timeout | blocked for security reasons |
defaut_charset
"UTF-8" is the default value and it 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 the iconv functions if the iconv.input_encoding, iconv.output_encoding and iconv.internal_encoding configuration options are not set, and for the mbstring functions if the mbstring.http_input, mbstring.http_output and mbstring.internal_encoding configuration options 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 overwritten via a call to the header() function.
max_input_var
The number of input variables that can be accepted (this limit applies separately to the superglobal variables $_GET, $_POST and $_COOKIE). Using this directive helps limit the possibility of denial-of-service attacks using hash collisions. If there are more input variables than the number specified by this directive, an E_WARNING type warning will be issued, and the extra variables will be removed from the request.
auto_prepend_file and auto_append_file
allow you to force the loading of a file before or after a php file. For example, instead of doing on all files, just use 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" allows you to temporarily disable OPCache compilation caching, which is useful for testing and debugging
display_errors
to display errors in browsers
error_reporting
selects which 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
Effectively using the .user.ini file requires some knowledge and special attention. Here are some 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 correct any potential issues without disrupting your live site. Second, if your site starts to experience problems after a modification to the user.ini file, that change is likely the cause. In that case, roll back and review your changes to identify the problem.
Check out this complete 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, enabling 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. Keep exploring, learning and optimizing. Your journey into the web world with LWS is just beginning.
Ask the LWS team and the community. Answers are published after moderation.