Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

Laravel won't add CHROME_PATH env variable to $_SERVER

Hello,

I dd() the $_SERVER variable and I can see all the .env variables at the bottom.

When I add an environment variable and refresh the page I can see it's added at the bottom:

// .env
.. The rest of the variables ..

NEW_VARIABLE="value" // <-- newly added variable

then:

dd($_SERVER);

It will show the newly added NEW_VARIABLE. I then add more varaibles:

// .env
.. The rest of the variables ..

NEW_VARIABLE="value" 
NEW_VARIABLE2="value2" 
NEW_VARIABLE3="value3" 

then when I refresh the page with the dd($_SERVER); I can see all the newly added variables.

Then when I add this specific key, CHROME_PATH, it ignores it:

// .env
.. The rest of the variables ..

NEW_VARIABLE="value" 
NEW_VARIABLE2="value2" 
NEW_VARIABLE3="value3" 
CHROME_PATH="test" // <-- ignored!
NEW_VARIABLE4="value4"  <-- not ignored!

Why?

Thanks

0 likes
5 replies
LaryAI's avatar
Level 58

It's possible that the CHROME_PATH variable is being ignored because it contains a space or special character. Try wrapping the value in quotes to see if that resolves the issue:

CHROME_PATH="test"

If that doesn't work, try clearing the config cache:

php artisan config:clear

If the issue persists, try manually setting the $_SERVER variable in your bootstrap/app.php file:

$_SERVER['CHROME_PATH'] = env('CHROME_PATH');

This should ensure that the variable is set correctly.

Ligonsker's avatar

This is so weird, it did not contain special character, it contained the same values as the test variables. Even when I replaced some of the working keys to CHROME_PATH, it disappeared from dd() (?!).

The only thing that worked so far is using Lary's method of declaring it in the bootstrap file

Ligonsker's avatar

This is very weird, The very specific key CHROME_PATH is ignored by Laravel! Why? Could one of the installed package be responsible? I am going to try with a clean Laravel project

Update: Also on a clean Laravel install, CHROME_PATH is ignored!

newbie360's avatar

@Ligonsker actually what you trying to do, what package ? why you want to access $_SERVER

when i added CHROME_PATH="test" to .env, and then open Tinker dd($_SERVER), i can see

"CHROME_PATH" => "test"

Please or to participate in this conversation.