0

I noticed when I did a var_dump on the $_SERVER superglobal there were some values that were not included in the php manual here: http://www.php.net/manual/en/reserved.variables.server.php For example that page doesn't talk about the HTTP_X_FORWARDED_FOR. In my dump I also had variables like PATH, PATHEXT, etc.

Am I on the wrong page, where can I read about ALL of the $_SERVER variables? Thanks.

2
  • 1
    The additional ones are configuration/host/OS/visitor dependent. for example, X_FORWARDED_FOR is generally for proxy use. Commented Mar 7, 2011 at 6:49
  • Where to read more about these vars? Your web server, e.g. Apache, documentation will help you. Commented Mar 7, 2011 at 6:51

3 Answers 3

2

Regarding $_SERVER

The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here. That said, a large number of these variables are accounted for in the CGI/1.1 specification, so you should be able to expect those.

Details about CGI/1.1 (where these variables should be accounted for as mentioned in the quote) are here. This does not take into account (as mentioned in another answer) OS variables like PATH, and so forth.

Sign up to request clarification or add additional context in comments.

Comments

1

ADDITIONALLY: $_SERVER also contains HTTP protocol variables, request headers in general, like those added by network devices [such as proxies, gateways etc], user-agents [browsers etc] and such... Since you can create your own custom protocol headers as well [those that start with "X-" prefix], the possibilities there are infinite. And of course, $_SERVER additionally contains certain server-specific variables as well, which can change in server-basis.

If you learn a little bit about HTTP protocol, I am sure it will be much clearer to you.

1 Comment

+1 @Shelhi; There are tons of environment (server and client) generated values it could be populated with. The inconsistency across requests is (I find) unfortunate, as sometimes valuable data can be captured.
0

No, these aren't simply listed in the manual but are available.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.