bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.61k forks source link

.env file under root directory could not be loaded when Multiple Applications with one CodeIgniter Installation #6049

Closed freeaircn closed 3 years ago

freeaircn commented 3 years ago

Install CI project though composer methed. For example, create another applications, named “foo”, project directories like this: /foo /app /public /tests /writable /app /public /tests /writable /vendor /codeigniter4/framework/system .env

When access "foo" application, in bootstrap.php, the ROOTPATH is set as /foo. While there is no .env file was defined under directory /foo, custom .env file was under directory /. This caused that custum .env file under directory / could not be loaded.

The code in bootstap.php as below is unreasonable for Multiple Applications with one CodeIgniter Installation. // The path to the project root directory. Just above APPPATH. if (!defined('ROOTPATH')) { define('ROOTPATH', realpath(APPPATH . '../') . DIRECTORY_SEPARATOR); }

gxgpet commented 3 years ago

Hello! This is the CI3 repository. If you are looking for CI4 repo, please see https://github.com/codeigniter4/CodeIgniter4.