Php Server Variable

$_SERVER is an array containing data, for example, headers, paths, and script locations. the passages in this exhibit are made by the webserver. There is no assurance that each web server will give any of these serves may preclude a few, or give others not recorded here.

This is a 'superglobal' or automatic global, variable. this just implies it is accessible in all extensions all through a content.. you don't need to do a global $_SERVER to access it within functions or methods, as you do with $HTTP_SERVER_VARS. $HTTP_SERVER_VARS and $_SERVER are different variables and that PHP handles them as such.


The name of the server host under which the current script is executing. If the script is running on a virtual host, this will be the value defined for that virtual host.


Server identification string, given in the headers when responding to requests.


Name and revision of the information protocol via which the page was requested. i.e. 'HTTP/1.0';


Which request method was used to access the page; i.e. 'GET','POST'.


The query string, if any via which the page was accessed.


The document root directory under which the current script is executing, as defined in the sever's configuration file.


Contents of the Host: header from the current request, if there if one.


The absolute pathname of the currently executing script.


The port on the server machine being used by the webserver for communication. for default setups, this will be '80'; using SSL for instance, will change this to whatever you defined secure HTTP port is.


It contains the current script's path. This is useful for pages that need to point to themselves.


The URI which was given in order to access this page; for instance,'/index.html'.