Allowing CRAFT_TEMPLATE_PATH in index.php from .env variable It appears on Craft 3.1.8 that I can't set the CRAFT_TEMPLATE_PATH from .env without throwing a PHP notice error. This appears to be because the .env is loaded after the defines and I want to access the .ENV for my CRAFTENV_template path.

How can I set CRAFT_TEMPLATE_PATH from my .env without producing an error/warning?
If you add it after you load the dot env stuff in your public index.php file, it should work:

// Load dotenv?
if (file_exists(CRAFT_BASE_PATH.'/.env')) {
    (new Dotenv(CRAFT_BASE_PATH))-&gt;load();
}

define('CRAFT_TEMPLATE_PATH', getenv('CRAFT_TEMPLATE_PATH'));