Difference between revisions of "Configuration file"
Line 46: | Line 46: | ||
= Usage in coding = | = Usage in coding = | ||
− | Content of file must be used by developers by using predefined constants or the object '''$conf''' created by the script '''master.inc.php''' that must be | + | Content of file must be used by developers by using predefined constants or the object '''$conf''' created by the script '''master.inc.php''' that must be includes at beginning of every PHP program (scripts or pages). |
+ | Your code must never open the config file and read it directly. This is not necessarly. | ||
− | |||
* $dolibarr_main_document_root is known in code in constant: DOL_DOCUMENT_ROOT | * $dolibarr_main_document_root is known in code in constant: DOL_DOCUMENT_ROOT | ||
* $dolibarr_main_url_root is known in code in constant: DOL_URL_ROOT | * $dolibarr_main_url_root is known in code in constant: DOL_URL_ROOT | ||
Line 58: | Line 58: | ||
* $dolibarr_main_db_pass is not known by code. It is read by script '''master.inc.php''' (to be called by every PHP pages) that created on object connexion '''$db''' then variable $dolibarr_main_db_pass is erased. | * $dolibarr_main_db_pass is not known by code. It is read by script '''master.inc.php''' (to be called by every PHP pages) that created on object connexion '''$db''' then variable $dolibarr_main_db_pass is erased. | ||
− | + | However, your development should never have to use this variables but only should use instead following global variable or constants: | |
− | + | * DOL_DOCUMENT_ROOT (that indicate physical path of directory where permanent or temporary files are stored) | |
− | + | * DOL_URL_ROOT (that indicate relative URL that is Dolibarr root). | |
+ | * $db | ||
+ | * $conf | ||
+ | * $user | ||
+ | * $langs | ||
See tutorial on page [[Module development|Module development]] or [[Script development]] for more information. | See tutorial on page [[Module development|Module development]] or [[Script development]] for more information. |
Revision as of 10:26, 14 October 2011
The Dolibarr configuration file is conf/conf.php. It is created by the automatic install process.
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 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 constants or the object $conf created by the script master.inc.php that must be includes at beginning of every PHP program (scripts or pages). Your code must never open the config file and read it directly. This is not necessarly.
- $dolibarr_main_document_root is known in code in constant: DOL_DOCUMENT_ROOT
- $dolibarr_main_url_root is known in code in constant: DOL_URL_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 (to be called by every PHP pages) that created on object connexion $db then variable $dolibarr_main_db_pass is erased.
However, your development should never have to use this variables but only should use instead following global variable or constants:
- DOL_DOCUMENT_ROOT (that indicate physical path of directory where permanent or temporary files are stored)
- DOL_URL_ROOT (that indicate relative URL that is Dolibarr root).
- $db
- $conf
- $user
- $langs
See tutorial on page Module development or Script development for more information.