Difference between revisions of "Configuration file"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
m
m
 
(26 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
<!-- BEGIN origin interlang links -->
 +
<!-- You can edit this section but do NOT remove these comments
 +
    Links below will be automatically replicated on translated pages by PolyglotBot -->
 +
[[fr:Fichier_de_configuration]]
 +
[[es:Fichero_de_configuración]]
 +
<!-- END interlang links -->
 +
 +
[[Category:Admin]]
 +
[[Category:Admin_en]]
 
{{TemplateDocDevEn}}
 
{{TemplateDocDevEn}}
{{ToTranslate}}
+
The Dolibarr configuration file is '''conf/conf.php'''. It is created by the automatic install process. This file contains the system setup. The setup of the applications you plan to use are defined into the setup area of each module, into the application itself (Menu Home - Setup - Modules).
 +
 
 +
 
 +
 
 +
 
 +
=Content=
 +
Content of this file is :
 +
<source lang="php">
 +
$dolibarr_main_document_root="/home/www/dolibarr/htdocs";
 +
$dolibarr_main_url_root="http://mydomain.com/dolibarr";
 +
$dolibarr_main_db_type="mysql";
 +
$dolibarr_main_db_host="localhost";
 +
$dolibarr_main_db_port="3306";
 +
$dolibarr_main_db_name="dolibarr";
 +
$dolibarr_main_db_user="dolibarr";
 +
$dolibarr_main_db_pass="";
 +
</source>
 +
 
 +
''' Other options''':
 +
<source lang="php">
 +
$dolibarr_main_demo="demologin,demopass"
 +
</source>
 +
-> Disable some features to limit software when used as a demo software. This is to avoid that everybody make everything with a demo instance of Dolibarr.
 +
 
 +
<source lang="php">
 +
$dolibarr_main_prod="1"
 +
</source>
 +
-> When this option is added in conf file, no information will be reported by Dolibarr when an internal error occurs. This is to use in a production environment to hide any information to hackers.
  
Le fichier de configuration de Dolibarr est '''conf/conf.php'''. Il est écrit par la procédure d'installation automatisée.
+
<source lang="php">
Le contenu du fichier standard est :
+
$dolibarr_main_authentication="dolibarr"
 +
</source>
 +
-> Allows to change the way the password is checked when a user ty to login to Dolibarr:
  
    $dolibarr_main_document_root="/home/www/dolibarr/htdocs";
+
*Value "dolibarr" means check is done with the password stored in database.
    $dolibarr_main_url_root="http://mondomaine.com/dolibarr";
+
*"ldap" ask to use a LDAP server (in this case, you must also define other LDAP parameters (See file conf.php.example)
    $dolibarr_main_db_type="mysql";
+
*"http" use basic http protocol (need to configure your web server to set dolibarr inside a basic authentication area)
    $dolibarr_main_db_host="localhost";
 
    $dolibarr_main_db_name="dolibarr";
 
    $dolibarr_main_db_user="dolibarr";
 
    $dolibarr_main_db_port="123456";
 
    $dolibarr_main_db_pass="";
 
  
Dolibarr fournit un fichier conf modèle nommé conf/conf.php.example où chaque paramètre est commenté.
+
<source lang="php">
 +
$dolibarr_main_force_https = "1";
 +
</source>
 +
-> Force url to https.
  
Ce fichier ne doit pas jamais être ni modifié, ni lu directement, par aucune fonctionnalité de Dolibarr.
+
Dolibarr provide a model of file named '''conf/conf.php.example''' where each parameter is commented.
  
Il est créé par la procédure d'installation ou de mise a jour de Dolibarr (install/index.php) qui est la seule habilitée à effectuer des actions sur ce fichier.
+
=Read/Write file=
 +
This file must never be modified, never read directly by any Dolibarr feature.
  
Le contenu de ce fichier est accessible au développement à travers de constantes ou de l'objet '''$conf''' créé par le script '''master.inc.php''' qui est appelé par tout programme PHP (scripts ou pages).
+
It is created by the install or update process of Dolibarr (install/index.php) that is the only process allowed to make actions on this file.
  
Ainsi:
+
=Usage in coding=
# $dolibarr_main_document_root est connu dans le code grâce à la constante: DOL_DOCUMENT_ROOT
+
Content of file must be used by developers by using predefined loaded constants or the object '''$conf''' created by the code into files '''master.inc.php''' or '''main.inc.php''' (that must be included at beginning of every PHP program: master.inc.php for scripts or main.inc.php for pages).
# $dolibarr_main_url_root est connu dans le code grâce à la constante: DOL_URL_ROOT
+
Your code must never open the config file and read it directly. This is not necessarly.
# $dolibarr_main_db_type est accessible par $conf->db->type
 
# $dolibarr_main_db_host est accessible par $conf->db->host
 
# $dolibarr_main_db_name est accessible par $conf->db->name
 
# $dolibarr_main_db_user est accessible par $conf->db->login
 
# $dolibarr_main_db_pass n'est pas accessible. Il est lu par le script '''master.inc.php''' (appelé par tout fichier PHP) qui crée un connexion db puis efface de sa mémoire le mot de passe.
 
  
Normalement, vos développements ne devraient avoir besoin que des constantes DOL_DOCUMENT_ROOT (qui indique le chemin physique du répertoire de stockage de fichiers temporaires ou à conserver) et DOL_URL_ROOT (qui indique le chemin URL vers le répertoire racine de Dolibarr).
+
*$dolibarr_main_data_root is known in code in constant: DOL_DATA_ROOT (that indicate physical path of directory with data files uploaded or created by Dolibarr).
D'autres informations et objets sont disponibles après insertion de l'include de '''master.inc.php''' dans son code.  
+
*$dolibarr_main_document_root is known in code in constant: DOL_DOCUMENT_ROOT (that indicate physical path of Dolibarr directory programs).
 +
*$dolibarr_main_url_root is known in code in constant: DOL_URL_ROOT (that indicate relative URL that is Dolibarr root).
 +
*$dolibarr_main_db_type is known in code on variable $conf->db->type
 +
*$dolibarr_main_db_host is known in code on variable $conf->db->host
 +
*$dolibarr_main_db_port is known in code on variable $conf->db->port
 +
*$dolibarr_main_db_name is known in code on variable $conf->db->name
 +
*$dolibarr_main_db_user is known in code on variable $conf->db->login
 +
*$dolibarr_main_db_pass is not known by code. It is read by script '''master.inc.php''' that created a connexion object '''$db''' then variable $dolibarr_main_db_pass is erased.
  
Voir les tutoriaux sur le [[Developpement_module|développements de modules]] Dolibarr pour plus d'information.
+
See tutorial on page [[Module development|Module development]] or [[Script development]] for more information.

Latest revision as of 10:59, 24 July 2019

The Dolibarr configuration file is conf/conf.php. It is created by the automatic install process. This file contains the system setup. The setup of the applications you plan to use are defined into the setup area of each module, into the application itself (Menu Home - Setup - Modules).



Content

Content of this file is :

$dolibarr_main_document_root="/home/www/dolibarr/htdocs";
$dolibarr_main_url_root="http://mydomain.com/dolibarr";
$dolibarr_main_db_type="mysql";
$dolibarr_main_db_host="localhost";
$dolibarr_main_db_port="3306";
$dolibarr_main_db_name="dolibarr";
$dolibarr_main_db_user="dolibarr";
$dolibarr_main_db_pass="";

Other options:

$dolibarr_main_demo="demologin,demopass"

-> Disable some features to limit software when used as a demo software. This is to avoid that everybody make everything with a demo instance of Dolibarr.

$dolibarr_main_prod="1"

-> When this option is added in conf file, no information will be reported by Dolibarr when an internal error occurs. This is to use in a production environment to hide any information to hackers.

$dolibarr_main_authentication="dolibarr"

-> Allows to change the way the password is checked when a user ty to login to Dolibarr:

  • Value "dolibarr" means check is done with the password stored in database.
  • "ldap" ask to use a LDAP server (in this case, you must also define other LDAP parameters (See file conf.php.example)
  • "http" use basic http protocol (need to configure your web server to set dolibarr inside a basic authentication area)
$dolibarr_main_force_https = "1";

-> Force url to https.

Dolibarr provide a model of file named conf/conf.php.example where each parameter is commented.

Read/Write file

This file must never be modified, never read directly by any Dolibarr feature.

It is created by the install or update process of Dolibarr (install/index.php) that is the only process allowed to make actions on this file.

Usage in coding

Content of file must be used by developers by using predefined loaded constants or the object $conf created by the code into files master.inc.php or main.inc.php (that must be included at beginning of every PHP program: master.inc.php for scripts or main.inc.php for pages). Your code must never open the config file and read it directly. This is not necessarly.

  • $dolibarr_main_data_root is known in code in constant: DOL_DATA_ROOT (that indicate physical path of directory with data files uploaded or created by Dolibarr).
  • $dolibarr_main_document_root is known in code in constant: DOL_DOCUMENT_ROOT (that indicate physical path of Dolibarr directory programs).
  • $dolibarr_main_url_root is known in code in constant: DOL_URL_ROOT (that indicate relative URL that is Dolibarr root).
  • $dolibarr_main_db_type is known in code on variable $conf->db->type
  • $dolibarr_main_db_host is known in code on variable $conf->db->host
  • $dolibarr_main_db_port is known in code on variable $conf->db->port
  • $dolibarr_main_db_name is known in code on variable $conf->db->name
  • $dolibarr_main_db_user is known in code on variable $conf->db->login
  • $dolibarr_main_db_pass is not known by code. It is read by script master.inc.php that created a connexion object $db then variable $dolibarr_main_db_pass is erased.

See tutorial on page Module development or Script development for more information.