Does anyone have any thoughts on this? Seems pretty important - your config and env variables do weird, unexplainable things when accessed from inside queued jobs...?
Any help?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm seeing very weird behavior when trying to access environment variables from queued jobs (on Laravel Forge, nginx web server, using beanstalkd for queues).
I have a .env file with lots of variables in it.
When I try to access environment variables from my queued Job, I get incredibly strange results, e.g.:
My .env file looks like:
APP_ENV=local
APP_KEY=base64:7QnDA97sxhgxhjxghjxgjhxc9wrrrVHiUvVW7sH/BzOqGXImTU9BY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
TEST=testval
FACEBOOK_APP_ID=8763846876763
MY_FACEBOOK_APP_ID=whatever
# many other environment variables defined here (not shown)
...
TWITTER_CONSUMER_KEY=khskshiusyisuyisuy
TWITTER_CONSUMER_SECRET=ioudousouodius
TWITTER_ACCESS_TOKEN_SECRET=hgfcxhgfchgvfghcfvhgfc
And when I dump $_ENV from inside the Job, I get:
'TEST' => 'testval',
'MY_FACEBOOK_APP_ID' => 'whatever',
'TWITTER_ACCESS_TOKEN_SECRET' => 'hgfcxhgfchgvfghcfvhgfc'
So:
And now, for the freaking weirdest thing of all...
When I do env('FACEBOOK_APP_ID') from inside the job, I get a a wrong, inexplainable value that's different from 8763846876763
Can anyone explain what's going on?
Please or to participate in this conversation.