Craft CMS 3 Installed but not working
Your answer didn't end up working for me, but I did get it working.

Update (or add) &quot;vlucas/phpdotenv&quot;: &quot;^5.0&quot; to composer.json
Edit the craft (or index) file's contents:

// Load dotenv?
// if (class_exists('Dotenv\Dotenv') &amp;&amp; file_exists(CRAFT_BASE_PATH.'/.env')) {
//     Dotenv\Dotenv::create(CRAFT_BASE_PATH)-&gt;load();
// }
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
if (file_exists(CRAFT_BASE_PATH.'/.env')) {
  $dotenv-&gt;load();
}

I can then retrieve my environment vars with:
$varOne = $_ENV['VAR_ONE'];
$varTwo = $_SERVER['VAR_TWO'];