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

Certain variables not being loaded #109

Closed
Juddling opened this issue Jul 29, 2015 · 5 comments
Closed

Certain variables not being loaded #109

Juddling opened this issue Jul 29, 2015 · 5 comments

Comments

@Juddling
Copy link

For some reason when Laravel calls Dotenv::load(), the skip on the following line is being called for just four of my .env variables: DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME

This is the skip stopping the variable being loaded into $_ENV
https://github.com/vlucas/phpdotenv/blob/1.1/src/Dotenv.php#L83

After calling the load method, if I call print_r( $_ENV ) these four values aren't present.

This only happens intermittently, for most requests there is no issue.

The host contains dots and the password contains a quote (not at the beginning or end), I doubt this is causing the issue but I thought I'd mention it.

BEFORE calling load, I can get these values using getenv() even though they aren't present in $_ENV or $_SERVER.

I'm using PHP 5.6.8 on windows through XAMPP 3.2.1

@chrisabrams
Copy link

I'm also having a very similar issue.

@jshah4517
Copy link

Same issue here, Windows 8, EasyPHP with PHP 5.6.4. Seems to vary a bit but can sometimes happen as often as on every 2nd or 3rd request. Doesn't appear to be happening on Mac OS X.

From a bit of debugging, it appears the .env file is sometimes not loaded or not available for reading at that point in time.

@nebulousGirl
Copy link

+1

Any idea on what might cause the issue?

I have done some debugging and found that this only affected getenv in my case. $_ENV and $_SERVER are properly filled. putenv also returns true when setting the variables, but getenv returns false when attempting to get any variable.

If I put getenv directly after putenv, getenv works as expected. There seem to have a problem with keeping the value for the whole request.

This happens with both load and overload.

@coatesap
Copy link

coatesap commented Dec 1, 2015

+1

Experiencing intermittent loading of environment variables on Windows 10, WAMP, PHP 5.4. Works probably 99% of the time, then fails on the 1%. Am using $_ENV.

@GrahamCampbell
Copy link
Collaborator

#76 (comment)

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

6 participants