-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
.env
file is not loaded sometimes
#756
Comments
.env
file sometimes.env
file is not loaded sometimes
I’m encountering the same issue with WP-CLI (not sure if this applies to your case). Reverting the changes didn’t resolve it for me, although I agree with the importance of the security fix. As a workaround, I found that setting Env\Env::$options to 15 resolved the issue. I don’t believe always reading the .env file would be harmful, though it might have a slight performance impact. The problem seems to arise when WP-CLI performs sequential calls. For example, running wp rewrite structure '/%postname%/' also triggers wp rewrite flush. During the second call, my environment variables ($_ENV) appear to be missing. Despite debugging, I haven’t been able to figure out why $_ENV is lost during the second execution. I also tried setting variables_order=EGPC in my PHP configuration, but unfortunately, it didn’t help. |
We used this software, adding The addition of |
@takotakot I don't think your comment is relevant to this issue? |
Version
1.26.0
What did you expect to happen?
Read all env values from
.env
file.What actually happens?
Environmental variables are not loaded from
.env
file andDB_HOST
value fallbacks tolocalhost
. "Error establishing a database connection" is thrown. Need to refresh a couple of times to open desired page. It happens like 33% times when navigating through the wp admin.I've found a workaround by reverting this #598 PR.
Steps to reproduce
.env
fileSystem info
Windows 10 Professional
Laragon 5.0.0
Apache httpd 2.4.35 VC15
PHP 8.1.3
MySQL 8.0.33-25 (external database)
Log output
Please confirm this isn't a support request.
Yes
The text was updated successfully, but these errors were encountered: