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

Is env function delayed? #14511

Closed
hakuno opened this issue Jul 27, 2016 · 6 comments
Closed

Is env function delayed? #14511

hakuno opened this issue Jul 27, 2016 · 6 comments

Comments

@hakuno
Copy link

hakuno commented Jul 27, 2016

Well, whenever I google about this error

[2016-07-27 15:29:08] local.ERROR: RuntimeException: No supported encrypter found. The cipher and / or key length are invalid. in C:...\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php:29

I found it is needed to regenerate a valid 32-length hash for AES-256-CBC. Okay, it's right.

However, I thought the ENV may be delaying to retrieve the custom data from the .env file. Because it appears again sometimes. Look at config/app.php for:

'key' => env('APP_KEY', 'someDifferentKeyFromTheDotEnvFile'),

Is it possible to decrypt the session with the wrong key at runtime?

Would OPCACHE improve that .env file reading? Is it any to do with config:cache for improvement?

Thanks in advance!

@GrahamCampbell
Copy link
Member

Thanks for getting in touch. You just need to run the config:cache command to persist any config updates. :)

@GrahamCampbell
Copy link
Member

Once the config is cached, we skip reading the .env file entirely. As well as improving performance, it also fixes issues with environment variables leaking through threads.

@hakuno
Copy link
Author

hakuno commented Jul 28, 2016

Thank you so, @GrahamCampbell
Whether it's possible... so I'm not crazy 😆 I'll rely on config:cache to solve the leaking.

@aledmb
Copy link

aledmb commented Aug 24, 2016

Hey guys, I'm having this issue from time to time. It's totally random. Every few requests, it fails reading the key from the .env file, but most of the request go through with no problems.

Running config:cache seems to do the trick, but this is on a development machine.

Is there any other way to get around this than running config:cache periodically?

@GrahamCampbell
Copy link
Member

No, sorry. This is a bug inherit to the way PHP works. Probably a no-fix. :(

@aledmb
Copy link

aledmb commented Aug 24, 2016

Cool, no problem. Thank you!

What should I search for if I want to learn more about this issue with PHP?

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

3 participants