Dolibarr/dolibarr · critical

Dolibarr setup is not yet complete. Click here to finish…

Error message

Dolibarr setup is not yet complete. Click here to finish Dolibarr install process

What it means

filefunc.inc.php checks $dolibarr_main_db_host from conf.php; if it is empty (and NOREQUIREDB is not defined) the database part of the installation has not been done. Dolibarr prints a centered notice 'Dolibarr setup is not yet complete' with a link to install/index.php and dies. Every page redirect here until the installer writes the DB parameters into conf.php.

Solutions

  1. Open http://your-server/htdocs/install/index.php and finish the install wizard, which writes $dolibarr_main_db_host (and DB name/user/pass) into htdocs/conf/conf.php.
  2. Or hand-edit conf.php and fill in dolibarr_main_db_host, dolibarr_main_db_name, dolibarr_main_db_user, dolibarr_main_db_pass.
  3. If this is an intentional DB-less script, add define('NOREQUIREDB') before including filefunc.inc.php/main.inc.php.
  4. Check the web server can write to htdocs/conf so the installer can persist the values.
  5. After setup, remove or secure the /install directory as Dolibarr recommends.

Example fix

// before (htdocs/conf/conf.php)
$dolibarr_main_db_host = '';
// after
$dolibarr_main_db_host = 'localhost';
$dolibarr_main_db_name = 'dolibarr';
$dolibarr_main_db_user = 'dolibarr';
$dolibarr_main_db_pass = '******';
Defensive patterns

Strategy: validation

Validate before calling

// check conf.php completeness before deploying
$conf = parse_ini_file('/var/www/dolibarr/htdocs/conf/conf.php');
if (empty($conf['dolibarr_main_db_host'])) {
    throw new RuntimeException('Run /install first: dolibarr_main_db_host missing');
}

Type guard

function dbConfigPresent(?array $conf): bool {
    return isset($conf['dolibarr_main_db_host'], $conf['dolibarr_main_db_name'])
        && $conf['dolibarr_main_db_host'] !== '';
}

Prevention

When it happens

Trigger: Fresh deployment where install/index.php was never completed; conf.php exists (so error 25 passed) but was created without the database section; DB parameters wiped/emptied in conf.php; a page that forgot define('NOREQUIREDB') in a DB-less context actually needing no DB.

Common situations: Manual conf.php creation copying only the file-path section; installing a new version over an old tree using a blank conf.php; Docker images where conf.php is provisioned but DB host is injected later; staging environment pointing to an empty template conf.php.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of Dolibarr/dolibarr@598aa4bdad (2026-09-14). Data as JSON: /api/errors/187a2460ef8a24ec. Report an issue: GitHub.

Appendix: source

Thrown at htdocs/filefunc.inc.php:360

			$tmpa = parse_url($_SERVER['HTTP_HOST']);
			$tmpb = parse_url($_SERVER['HTTP_REFERER']);
			if ((empty($tmpa['host']) ? $tmpa['path'] : $tmpa['host']) != (empty($tmpb['host']) ? $tmpb['path'] : $tmpb['host'])) {
				$csrfattack = true;
			}
		}
		if ($csrfattack) {
			//print 'NOCSRFCHECK='.defined('NOCSRFCHECK').' REQUEST_METHOD='.$_SERVER['REQUEST_METHOD'].' HTTP_HOST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER'];
			// Note: We can't use dol_escape_htmltag here to escape output because lib functions.lib.ph is not yet loaded.
			dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (Bad referrer).", LOG_WARNING);
			print "Access refused by CSRF protection in main.inc.php. Referrer of form (".htmlentities(empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'], ENT_COMPAT, 'UTF-8').") is outside the server that serve this page (with method = ".htmlentities($_SERVER['REQUEST_METHOD'], ENT_COMPAT, 'UTF-8').").\n";
			print "If you access your server behind a proxy using url rewriting, you might check that all HTTP headers are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file to remove this security check).\n";
			die;
		}
	}
	// Another test is done later on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on.
}
if (empty($dolibarr_main_db_host) && !defined('NOREQUIREDB')) {
	print '<div class="center">Dolibarr setup is not yet complete.<br><br>'."\n";
	print '<a href="install/index.php">Click here to finish Dolibarr install process</a> ...</div>'."\n";
	die;
}
if (empty($dolibarr_main_url_root) && !defined('NOREQUIREVIRTUALURL')) {
	print 'Value for parameter \'dolibarr_main_url_root\' is not defined in your \'htdocs\conf\conf.php\' file.<br>'."\n";
	print 'You must add this parameter with your full Dolibarr root Url (Example: http://myvirtualdomain/ or http://mydomain/mydolibarrurl/)'."\n";
	die;
}

if (empty($dolibarr_main_url_root_alt)) {
	$dolibarr_main_url_root_alt = '/custom';
}
if (empty($dolibarr_main_document_root_alt)) {
	$dolibarr_main_document_root_alt = $dolibarr_main_document_root.'/custom';
}

if (empty($dolibarr_main_data_root)) {
	// If directory not defined, we use the default hardcoded value

View on GitHub (pinned to 598aa4bdad)