Jump to content

Reliability of some $_SERVER elements.


JasonLewis

Recommended Posts

I'm curious as to how reliable some of the $_SERVER elements are, mainly the ones related to the URI and Query String.

 

What I'm doing is building a query string using $_SERVER['QUERY_STRING'], however I'm unsure of how reliable it is

 

I am aware that a few of the elements in the predefined variable can be unreliable, but what about the QUERY_STRING element?

 

Cheers.

Link to comment
https://forums.phpfreaks.com/topic/207621-reliability-of-some-_server-elements/
Share on other sites

What you see is what you get on this var. Every http server needs a request uri. Therefor it will be populated in every condition except one:

When a PHP script is run from a command line or similar. Although I'm pretty sure this variable still populates even under those circumstances.

 

-cb-

The $_SERVER vars are populated by the webserver, not PHP, so they are implementation dependent.  Take a look at the cgi spec.  I would assume that all of these will be implemented by modern webservers:  http://web.archive.org/web/20071018185254/http://hoohoo.ncsa.uiuc.edu/cgi/env.html

The $_SERVER vars are populated by the webserver, not PHP, so they are implementation dependent.  Take a look at the cgi spec.  I would assume that all of these will be implemented by modern webservers:  http://web.archive.org/web/20071018185254/http://hoohoo.ncsa.uiuc.edu/cgi/env.html

 

Well, according to that page in regards to QUERY_STRING:

 

This variable should always be set when there is query information, regardless of command line decoding.

 

Very good. Thanks for that link.

 

Thanks for your time guys. Appreciate it. :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.