i'm trying to understand PHP nowadays and i'm stuck on printing out my app's name from a .env file by using "phpdotenv" directory from composer. i've created these files: Index.php, _env.php and .env i'm using xampp - apache and i've configured a localhost on my machine.
this is my code by far:
index.php:
<?php
require_once __DIR__.'\..\app\config\_env.php';
$app_name= getenv('APP_NAME');
$app_url=getenv('APP_URL');
echo $app_name;
echo $app_url;
?>
_env.php:
<?php
define('BASE_PATH',realpath(__DIR__.'\..\..'));
require_once __DIR__.'\..\..\vendor\autoload.php';
$dotEnv = \Dotenv\Dotenv::createImmutable(BASE_PATH);
$dotEnv->load();
?>
.env:
APP_URL=http://buzzstore.test
APP_ENV=local
APP_NAME="Buzz E-commerce store"
#database
DB_DRIVER='mysql'
DB_HOST=localhost
DB_NAME=store
DB_USERNAME=store
DB_PASSWORD=secret
the output should be "Buzz E-commerce store" and then the url http://buzzstore.test but i only get a blank page on chrome without anything (and no errors, after i fixed some of them). if there are some PHP experts here that can help me with this, i'll be thankful :)