Dolibarr/dolibarr · critical
Error: Dolibarr config file content seems to be not…
Error message
Error: Dolibarr config file content seems to be not correctly defined (dolibarr_main_document_root can't be unknown / file ${DOL_DOCUMENT_ROOT}/core/lib/functions.lib.php not found). Please run dolibarr setup by calling page <b>/install</b>. What it means
filefunc.inc.php, after loading conf.php, verifies that DOL_DOCUMENT_ROOT is set and that <DOL_DOCUMENT_ROOT>/core/lib/functions.lib.php physically exists. If not, the config file's dolibarr_main_document_root path is wrong or the install tree is incomplete, so it prints this setup error and stops. It guards against running Dolibarr with a broken configuration before any library code is loaded.
Solutions
- Edit htdocs/conf/conf.php and set $dolibarr_main_document_root to the absolute filesystem path of the htdocs directory (e.g. '/var/www/dolibarr/htdocs').
- Verify that <path>/core/lib/functions.lib.php exists and is readable by the web server (ls -l / check permissions, SELinux context).
- Re-upload/restore the complete htdocs tree if files are missing (compare against a release archive).
- On moved installs also fix dolibarr_main_url_root in conf.php to the new URL.
- If conf.php was generated by the installer for a different environment, re-run /install or hand-edit it for the new paths.
Example fix
// before (htdocs/conf/conf.php) $dolibarr_main_document_root = '/home/olduser/dolibarr/htdocs'; // after $dolibarr_main_document_root = '/var/www/dolibarr/htdocs'; $dolibarr_main_url_root = 'https://doli.example.com';
Defensive patterns
Strategy: validation
Validate before calling
// verify config before bootstrapping Dolibarr
$root = '$dolibarr_main_document_root value from conf.php';
if (empty($root) || !is_file(rtrim($root,'/').'/core/lib/functions.lib.php')) {
throw new RuntimeException('dolibarr_main_document_root is empty or points to an incomplete htdocs tree');
} Type guard
function dolDocumentRootIsValid(?string $root): bool {
return !empty($root) && is_dir($root) && is_file(rtrim($root, '/').'/core/lib/functions.lib.php');
} Prevention
- After moving or copying the install, always update dolibarr_main_document_root to the new absolute htdocs path.
- Verify file existence and web-server read permissions (and SELinux contexts) after deploys.
- Deploy the full htdocs tree atomically; never ship conf.php without matching code.
- In containers, mount conf.php into the same image path the code was built for.
- Keep a post-deploy smoke check that loads the homepage and fails on 'config file content seems to be not correctly defined'.
When it happens
Trigger: conf.php defines a dolibarr_main_document_root that is empty or points to a directory lacking core/lib/functions.lib.php (bad path after moving the install, wrong case, missing files after a partial upgrade/git checkout).
Common situations: Moving Dolibarr to another server/directory without editing htdocs/conf/conf.php; deploying only conf.php (persistent volume) to a fresh container with a mismatched path; typos like missing trailing component or Windows path vs Linux; incomplete upload/extract of htdocs.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Value for parameter 'dolibarr_main_url_root' is not defined…
- If define NOREQUIREDB or NOREQUIRETRAN are set, you must…
- If define NOREQUIREUSER is set, you must also set…
- If you access your server behind a proxy using url…
- ErrorConfigParameterNotDefined
AI-assisted analysis of Dolibarr/dolibarr@598aa4bdad (2026-09-14).
Data as JSON: /api/errors/ae6c801bd6d6449a.
Report an issue: GitHub.
Appendix: source
Thrown at htdocs/filefunc.inc.php:312
$dolibarr_mailing_limit_sendbyweb = 0;
}
if (empty($dolibarr_mailing_limit_sendbycli)) {
$dolibarr_mailing_limit_sendbycli = 0;
}
if (empty($dolibarr_mailing_limit_sendbyday)) {
$dolibarr_mailing_limit_sendbyday = 0;
}
if (empty($dolibarr_strict_mode)) {
$dolibarr_strict_mode = 0; // For debug in php strict mode
}
if (!defined('DOL_DOCUMENT_ROOT')) {
define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
}
// @phpstan-ignore-next-line if.alwaysTrue
if (empty(DOL_DOCUMENT_ROOT) || !file_exists(DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php")) {
print "Error: Dolibarr config file content seems to be not correctly defined";
if (empty($dolibarr_main_document_root)) {
print " (dolibarr_main_document_root can't be unknown).<br>\n";
} else {
print " (file ".DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php not found).<br>\n";
}
print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n";
exit(1);
}
// Included by default (must be before the CSRF check so wa can use the dol_syslog)
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/html.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/securitycore.lib.php';
//print memory_get_usage();
View on GitHub (pinned to 598aa4bdad)