Configuration file
The Dolibarr configuration file is conf/conf.php. It is created by the automatic install process. 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_name="dolibarr"; $dolibarr_main_db_user="dolibarr"; $dolibarr_main_db_port="123456"; $dolibarr_main_db_pass="";
Dolibarr provide a model of file named conf/conf.php.example where each parameter is commented.
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.
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 called at beginning of every PHP program (scripts or pages).
So:
- $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_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 (called by every PHP program) that created on object connexion $db then variable $dolibarr_main_db_pass is erased.
You development should only need to use constants DOL_DOCUMENT_ROOT (that indicate physical path of directory where permanent or temporary files are stored) and DOL_URL_ROOT (that indicate relative URL that is Dolibarr root). More information and objects are available after including a call to main.inc.php in your PHP pages.
See tutorial on page Module development for more information.