Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For Codeigniter 3, dotenv loading must be done in index.php #1

Open
xalfeiran opened this issue Jan 29, 2024 · 1 comment
Open

For Codeigniter 3, dotenv loading must be done in index.php #1

xalfeiran opened this issue Jan 29, 2024 · 1 comment

Comments

@xalfeiran
Copy link

To properly load the .env variables into the configuration, dotenv must be loaded before Codeigniter.php

require APPPATH . 'vendor/autoload.php';
$dotenv = Dotenv\Dotenv::create(APPPATH);
$dotenv->load();
/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 */
require_once BASEPATH.'core/CodeIgniter.php';
@sunuazizrahayu
Copy link
Owner

To properly load the .env variables into the configuration, dotenv must be loaded before Codeigniter.php

require APPPATH . 'vendor/autoload.php';
$dotenv = Dotenv\Dotenv::create(APPPATH);
$dotenv->load();
/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 */
require_once BASEPATH.'core/CodeIgniter.php';

yes, you're right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants