Support the ongoing development of Laravel.io →
Laravel
Last updated 3 months ago.
0

I think you'll have to take this up with the package maintainer to have them change that behavior.

If you're using queue:listen like in that linked GitHub issue, the problem may be that the queue:listen command creates sub-processes (separate queue:work commands) that don't seem to inherit the parent's environment variables.

0

@fideloper

Thanks for your reply!

I am not the maintainer of the package, but a contributor writing a PR. And this isn't a problem with the package. The package is just vanilla php. It's definitely an issue with Laravel. But I will look into what you suggested. Thanks.

0

Well, I can't find anywhere in Laravel empties the $_ENV global, but there are definitely circumstances around the DotEnv package + how processes work that might be making $_ENV empty in some cases.

Perhaps your AppServiceProvider can set $_ENV['foo'] = 'bar'; with the appropriate key/variable if it finds that variable it's not already set.

1

@fideloper

Thanks for commenting again!

And yea, I'll have to find some other option, like binding to the container in a service provider like you have suggested.

But there is a ton of issues out there referencing this behavior with $_ENV.

One here.

0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.