{"record":{"id":"7a0665296b733509","repo":"Dolibarr/dolibarr","slug":"sorrywebsiteiscurrentlyoffline","errorCode":null,"errorMessage":"SorryWebsiteIsCurrentlyOffLine","messagePattern":"SorryWebsiteIsCurrentlyOffLine","errorType":"http","errorClass":null,"httpStatus":503,"severity":"critical","filePath":"htdocs/master.inc.php","lineNumber":253,"sourceCode":"\t$db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);\n\t/**\n\t * @var DoliDB $db\n\t */\n\n\tif ($db->error) {\n\t\tif (is_object($langs)) {\n\t\t\t$langs->setDefaultLang('auto');\n\t\t}\n\t\t// If we were into a website context\n\t\tif (!defined('USEDOLIBARREDITOR') && !defined('USEDOLIBARRSERVER') && !empty($_SERVER['SCRIPT_FILENAME']) && (strpos($_SERVER['SCRIPT_FILENAME'], DOL_DATA_ROOT.'/website') === 0)) {\n\t\t\t$sapi_type = php_sapi_name();\n\t\t\tif (substr($sapi_type, 0, 3) != 'cgi') {\n\t\t\t\thttp_response_code(503); // To tel search engine this is a temporary error\n\t\t\t}\n\t\t\tprint '<div class=\"center\" style=\"text-align: center; margin: 100px;\">';\n\t\t\tif (is_object($langs)) {\n\t\t\t\t$langs->load(\"website\");\n\t\t\t\tprint $langs->trans(\"SorryWebsiteIsCurrentlyOffLine\");\n\t\t\t} else {\n\t\t\t\tprint \"SorryWebsiteIsCurrentlyOffLine\";\n\t\t\t}\n\t\t\tprint '</div>';\n\t\t\texit(1);\n\t\t}\n\t\tdol_print_error($db, \"host=\".$conf->db->host.\", port=\".$conf->db->port.\", user=\".$conf->db->user.\", databasename=\".$conf->db->name.\", \".$db->error);\n\t\texit(1);\n\t}\n}\n\n// Now database connection is known, so we can forget password\n//unset($dolibarr_main_db_pass); \t// We comment this because this constant is used in some other pages\nunset($conf->db->pass); // This is to avoid password to be shown in memory/swap dump\n\n\n/*\n * Create object $user","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/Dolibarr/dolibarr/blob/598aa4bdada683d17ca04b1842548821ff0eb6c6/htdocs/master.inc.php#L235-L271","documentation":"When the database connection fails ($db->error set) during bootstrap and the request targets a hosted website page (script path under DOL_DATA_ROOT/website), Dolibarr responds with HTTP 503 and prints the translated 'SorryWebsiteIsCurrentlyOffLine' message, then exits. It tells visitors and search engines the website is temporarily unavailable rather than exposing DB details.","triggerScenarios":"A request to a page under the website directory (USEDOLIBARREDITOR/USEDOLIBARRSERVER not defined, SCRIPT_FILENAME starting with DOL_DATA_ROOT.'/website') while getDoliDBInstance() fails — bad DB host/port/credentials in conf.php, DB server down, or DB name wrong.","commonSituations":"MySQL/MariaDB stopped or crashed; conf.php pointing at the wrong DB host after a migration; wrong DB password after rotation; the public website view of Dolibarr's website module rendered while the DB is unreachable.","solutions":["Check database server status (systemctl status mysql/mariadb) and restart if down","Verify conf.php DB settings: $dolibarr_main_db_host, $dolibarr_main_db_port, $dolibarr_main_db_user, $dolibarr_main_db_name, $dolibarr_main_db_pass","Test credentials manually (mysql -h host -P port -u user -p dbname)","Check DB error logs for max_connections or access-denied errors"],"exampleFix":"// before (conf.php)\n$dolibarr_main_db_host='old-db-host';\n// after\n$dolibarr_main_db_host='localhost';","handlingStrategy":"fallback","validationCode":"// before serving website pages, verify DB reachability\n$test = @mysqli_connect($host, $user, $pass, $name, (int)$port);\nif (!$test) { show_maintenance_page(); }","typeGuard":null,"tryCatchPattern":"// monitor for 503 responses on /website/* routes and alert ops\nif ($httpCode === 503 && strpos($url, '/website/') !== false) { trigger_db_alert(); }","preventionTips":["Monitor the DB service with health checks","Pin correct DB credentials in conf.php and version-control a template","Set up alerts on MySQL 'max_connections' and crash loops","Schedule website module availability checks"],"tags":["database","connection","website"],"backgroundTag":"connection-refused","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"}