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

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.



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.


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.



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.


Sign in to participate in this thread!

Full Stack Europe

Your banner here too?


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 - All rights reserved.