Codeigniter - Problem in installing phpdotenv library (.env - for environment variables)

Asked

Viewed 112 times

0

I am trying to install phpdotenv in Codeigniter 3 by following these instructions:

Environment Variables in Codeigniter

But, it’s giving the following problem:

A PHP Error was encountered Severity: 4096

Message: Argument 1 passed to Dotenv Dotenv::__Construct() must be an instance of Dotenv Loader, string Given, called in /application/config/Hooks.php on line 5 and defined

Filename: src/Dotenv.php

Line Number: 31

My file /application/config/Hooks.php is configured in the same way as indicated in the tutorial:

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$hook['pre_system'] = function() {
    $dotenv = new Dotenv\Dotenv(APPPATH);
    $dotenv->load();
};

I’ve already researched, but I haven’t found the solution yet.
Does anyone have any idea how to solve this problem?

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.