bootEnv(dirname(__DIR__).'/.env'); // A freshly unpacked installation has no secret, and without one nothing boots - not even the // installer that would explain why. So the first request writes one into .env.local and never // touches it again. If the project directory is not writable, the request still works, but only // this one: the installer's system check says so in a sentence instead of leaving a white page. if (!isset($_SERVER['APP_SECRET']) || '' === $_SERVER['APP_SECRET']) { $secret = bin2hex(random_bytes(32)); $file = dirname(__DIR__).'/.env.local'; $existing = is_file($file) ? (string) file_get_contents($file) : ''; if (false === @file_put_contents($file, $existing.(str_ends_with($existing, "\n") || '' === $existing ? '' : "\n").'APP_SECRET="'.$secret.'"'."\n")) { $secret .= '-nicht-gespeichert'; } else { @chmod($file, 0o600); } $_SERVER['APP_SECRET'] = $_ENV['APP_SECRET'] = $secret; }