Apr 23, 2021
0
Level 10
Fatal error: Uncaught Error: Call to undefined function Dotenv\Dotenv()
I am trying to build a website to practice a code where. I am finding a strange error
Which I am unable to replicate how to solve the issue.
I have followed the steps.
I already downloaded the Vendor by Composer and here is the code I have used.
.env
APP_URL=http://oxbir.me
APP_ENV=local
APP_NAME="ACSE E-Commerce Store"
index.php
<?php
require_once __DIR__.'/../bootstrap/init.php';
$app_name = getenv('APP_NAME');
echo $app_name;
init.php
<?php
require_once __DIR__.'/../app/config/_env.php';
_env.php
<?php
define('BASE_PATH', realpath(__DIR__.'/../../'));
require_once __DIR__.'/../../vendor/autoload.php';
$dotEnv = Dotenv\Dotenv(BASE_PATH);
$dotEnv->load();
Please or to participate in this conversation.

