{"record":{"id":"187a2460ef8a24ec","repo":"Dolibarr/dolibarr","slug":"dolibarr-setup-is-not-yet-complete-click-here-to-finish","errorCode":null,"errorMessage":"Dolibarr setup is not yet complete. Click here to finish Dolibarr install process","messagePattern":"Dolibarr setup is not yet complete\\. Click here to finish Dolibarr install process","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"htdocs/filefunc.inc.php","lineNumber":360,"sourceCode":"\t\t\t$tmpa = parse_url($_SERVER['HTTP_HOST']);\n\t\t\t$tmpb = parse_url($_SERVER['HTTP_REFERER']);\n\t\t\tif ((empty($tmpa['host']) ? $tmpa['path'] : $tmpa['host']) != (empty($tmpb['host']) ? $tmpb['path'] : $tmpb['host'])) {\n\t\t\t\t$csrfattack = true;\n\t\t\t}\n\t\t}\n\t\tif ($csrfattack) {\n\t\t\t//print 'NOCSRFCHECK='.defined('NOCSRFCHECK').' REQUEST_METHOD='.$_SERVER['REQUEST_METHOD'].' HTTP_HOST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER'];\n\t\t\t// Note: We can't use dol_escape_htmltag here to escape output because lib functions.lib.ph is not yet loaded.\n\t\t\tdol_syslog(\"--- Access to \".(empty($_SERVER[\"REQUEST_METHOD\"]) ? '' : $_SERVER[\"REQUEST_METHOD\"].' ').$_SERVER[\"PHP_SELF\"].\" refused by CSRF protection (Bad referrer).\", LOG_WARNING);\n\t\t\tprint \"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\";\n\t\t\tprint \"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\";\n\t\t\tdie;\n\t\t}\n\t}\n\t// Another test is done later on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on.\n}\nif (empty($dolibarr_main_db_host) && !defined('NOREQUIREDB')) {\n\tprint '<div class=\"center\">Dolibarr setup is not yet complete.<br><br>'.\"\\n\";\n\tprint '<a href=\"install/index.php\">Click here to finish Dolibarr install process</a> ...</div>'.\"\\n\";\n\tdie;\n}\nif (empty($dolibarr_main_url_root) && !defined('NOREQUIREVIRTUALURL')) {\n\tprint 'Value for parameter \\'dolibarr_main_url_root\\' is not defined in your \\'htdocs\\conf\\conf.php\\' file.<br>'.\"\\n\";\n\tprint 'You must add this parameter with your full Dolibarr root Url (Example: http://myvirtualdomain/ or http://mydomain/mydolibarrurl/)'.\"\\n\";\n\tdie;\n}\n\nif (empty($dolibarr_main_url_root_alt)) {\n\t$dolibarr_main_url_root_alt = '/custom';\n}\nif (empty($dolibarr_main_document_root_alt)) {\n\t$dolibarr_main_document_root_alt = $dolibarr_main_document_root.'/custom';\n}\n\nif (empty($dolibarr_main_data_root)) {\n\t// If directory not defined, we use the default hardcoded value","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/Dolibarr/dolibarr/blob/598aa4bdada683d17ca04b1842548821ff0eb6c6/htdocs/filefunc.inc.php#L342-L378","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Or hand-edit conf.php and fill in dolibarr_main_db_host, dolibarr_main_db_name, dolibarr_main_db_user, dolibarr_main_db_pass.","If this is an intentional DB-less script, add define('NOREQUIREDB') before including filefunc.inc.php/main.inc.php.","Check the web server can write to htdocs/conf so the installer can persist the values.","After setup, remove or secure the /install directory as Dolibarr recommends."],"exampleFix":"// before (htdocs/conf/conf.php)\n$dolibarr_main_db_host = '';\n// after\n$dolibarr_main_db_host = 'localhost';\n$dolibarr_main_db_name = 'dolibarr';\n$dolibarr_main_db_user = 'dolibarr';\n$dolibarr_main_db_pass = '******';","handlingStrategy":"validation","validationCode":"// check conf.php completeness before deploying\n$conf = parse_ini_file('/var/www/dolibarr/htdocs/conf/conf.php');\nif (empty($conf['dolibarr_main_db_host'])) {\n    throw new RuntimeException('Run /install first: dolibarr_main_db_host missing');\n}","typeGuard":"function dbConfigPresent(?array $conf): bool {\n    return isset($conf['dolibarr_main_db_host'], $conf['dolibarr_main_db_name'])\n        && $conf['dolibarr_main_db_host'] !== '';\n}","tryCatchPattern":null,"preventionTips":["Finish install/index.php on every new environment before exposing pages.","Keep a canonical conf.php template with all required keys (document root, DB, URL).","In container provisioning, write DB parameters in the same step as conf.php.","Add define('NOREQUIREDB') only to genuinely DB-less entry scripts.","Include a config-completeness check in deployment health tests."],"tags":["installation","database","configuration"],"backgroundTag":"missing-required-config","analyzedSha":"598aa4bdada683d17ca04b1842548821ff0eb6c6","analyzedAt":"2026-09-14T11:12:15.309Z","contentChangedAt":"2026-09-14T11:12:15.309Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}