How do I configure my .user.ini file on the LWS Panel?

Procédure

Introduction

Welcome to this documentation dedicated to the use of the .user.ini file on hosting packages managed with the LWS Panel. We'll be looking at how to create and configure the .user.ini file, its usefulness and its role in optimising your website. Our aim? To help you master this tool and make your online presence a success. Let's get started without further ado.

I. What is the user.ini file?

The .user.ini file is an essential part of the configuration of your website hosted on the LWS Panel. More specifically, it is a configuration file specific to PHP. 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 for fine-tuning your site's behaviour.

II. How do I create a user.ini file?

Creating a .user.ini file is a relatively simple process, but requires access to your website's storage space. To do this, access 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 at the root of your site. You can then open this file directly with 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 of priority and in the form :

directive_name = "directive_value"

Don't forget to save your changes before closing the file.

III. Why and when should you use a .user.ini file?

Using the user.ini file is particularly useful when you want to modify PHP parameters 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 a particular character interpretation that you use in your project. In such cases, the .user.ini file can be an indispensable tool. However, it should be noted that changes to this file should always be made with care, as they can have a significant impact on the operation of your site.

IV. What directives are authorised in the .user.ini file?

It is crucial to remember that not all directives are authorised in the user.ini file. For reasons of security and server stability, certain 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 authorised. This is an essential step in preserving the integrity of your site and avoiding unexpected problems.

You can find all the directives that can be used in a user.ini file on this official PHP documentation.

Exclusions :

For reasons of security and server stability, certain 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 php.ini or httpd.conf files to which the user does not have 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 changed directly in the PHP configuration on the LWS Panel
post_max_size Can be modified directly in the PHP configuration on the LWS Panel
upload_max_filesize Can be modified directly in the PHP configuration on the LWS Panel
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

V. Some practical uses

default_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 default_charset value will also be used to set the default character set for iconv functions if the iconv.input_encoding, iconv.output_encoding and iconv.internal_encoding configuration options are not set, and for mbstring functions if the mbstring.http_input, mbstring.http_output and mbstring.internal_encoding configuration options are not set.

All versions of PHP 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 is applied to the superglobal variables $_GET, $_POST and $_COOKIE, separately). Using this directive limits the possibility of a denial of service attack using hash collisions. If there are more input variables than the number specified by this directive, an E_WARNING will be issued, and the excess variables will be removed from the request.

auto_prepend_file and auto_append_file

can be used to force a file to be loaded before or after php. For example, instead of doing on all files, just do auto_prepend_file = header.php to load it.

Wordfence uses this to load its firewall script before WordPress.

opcache.enable

Setting the value of this variable to "0" temporarily disables OPCache compilation caching, which is useful for testing and debugging.

display_errors

to display errors in browsers

error_reporting

selects the types of error to be displayed (all, all except notice, all errors and warnings only, all except deprecated, etc.)

short_open_tag

allows or disallows short tags (<? to say <?php)

VI. Tips and tricks for using the .user.ini file effectively

Effective use of the .user.ini file requires a certain amount of knowledge and attention. Here are a few tips to help you get the most out of this tool. Firstly, always test your changes in a development environment before applying them to your production site. This will allow you to identify and correct any problems without disrupting your live site. Secondly, if your site starts to experience problems after a modification to the user.ini file, it is likely that this modification is the cause. In this case, go back and examine your changes to identify the problem.

Conclusion

Well done! You now have a more in-depth understanding of how to use the user.ini file with the LWS Panel. This guide has provided you with valuable information on how to create, configure and make the best use of this file, enabling you to improve the performance and security of your site. 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 optimising. Your journey into the world of the web with LWS has just begun.

Rate this article :

This article was useful to you ?

Article utileYes

Article non utileNo

Vous souhaitez nous laisser un commentaire concernant cet article ?

Si cela concerne une erreur dans la documentation ou un manque d'informations, n'hésitez pas à nous en faire part depuis le formulaire.

Pour toute question non liée à cette documentation ou problème technique sur l'un de vos services, contactez le support commercial ou le support technique

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles

1mn reading

How do I configure PHP on my hosting?

2mn reading

How do I create a cron job?

3mn reading

Customisation of error pages

0mn reading

How to access Apache / Php logs


Ask the LWS team and its community a question