(05-29-2025, 02:50 PM)chenzen Wrote: In the version 4.4.6...the following code was in the index.php file
...
Any reason it was taken out of there ?
Because of improvements to the framework. Things change sometimes - in CodeIgniter4 world, especially in the minor versions.
(05-29-2025, 02:50 PM)chenzen Wrote: 1. The version available on the website, the environment file does not load after you rename it, kindly check that.
The
.env is "kind of" hardcoded, so you can't change its name for anything else.
(05-29-2025, 02:50 PM)chenzen Wrote: 2. The code to load the ENV file in the index.php was a very good thing, if we can have it back there it's ok. Or at least the location should be set in the Config/Paths.php, just like the other items in the ROOTPATH..."system", "app" etc..
I am not convinced that we should provide a simple way to change the location of the
.env file. But if someone sends a PR, we will consider it.
That said, if you know exactly what you're doing (and it seems you do), you can create your own version of the
Boot.php file inside the
app folder. Extend the original class and override the
loadDotEnv() method with your custom logic - you can then change both: path and the env file name.
Finally, update your
index.php to load
app/Boot.php instead of the system one, and you're good to go.