Graham
Graham

Reputation: 8181

Is it possible to read environment variables from php?

The environment variable logonserver is available from the cmd prompt

echo %logonserver%

Is it possible to read this variable from php which will be accessed via a browser and not the cmd prompt, which means I can't pass the value in as a parameter.

I know I could shell out to cmd and get it that way, but I was wondering if there was some built-in php functionality for this.

Upvotes: 0

Views: 89

Answers (1)

Mantas
Mantas

Reputation: 4296

Yes. All environment variables are accessible through super-global $_SERVER variable. Just try var_dump($_SERVER) to see what's inside.

Upvotes: 2

Related Questions