PHP $_server

Source: Internet
Author: User
Tags http authentication http digest authentication
$_server is an array of information, such as header information (header), path, and script location (scripts locations), and so on. The items in this array are created by the WEB server. There is no guarantee that each server will provide all the items, the server may ignore some, or provide some items that are not listed here.

The following table lists the important elements in all $_server variables.

Element/Code Description
$_server[' Php_self '] The file name of the current execution script, which is related to document root.
$_server[' Gateway_interface '] The version of the CGI specification used by the server.
$_server[' Server_addr '] The IP address of the server where the script is currently running.
$_server[' server_name '] The host name of the server where the script is currently running. If the script is running on a virtual host, the name is determined by the value set by that virtual host.
$_server[' Server_software '] The server identification string, given in the header information in response to the request.
$_server[' Server_protocol '] The name and version of the communication protocol when the page is requested.
$_server[' Request_method '] The request method used by the access page.
$_server[' Request_time '] Timestamp at the start of the request. Available from PHP 5.1.0.
$_server[' query_string '] Query string, if any, for page access.
$_server[' Http_accept '] Accept: The contents of the item, if any, in the current request header.
$_server[' Http_accept_charset '] Accept-charset in the current request header: The contents of the item, if one exists.
$_server[' Http_host '] Host in current request header: The contents of the item, if one exists.
$_server[' Http_referer '] The address, if any, that directs the user's agent to the previous page of the current page. Determined by the user agent settings. Not all user agents will set the item, and some also provide the ability to modify the Http_referer. In short, the value is not trustworthy. )
$_server[' HTTPS '] If the script is accessed through the HTTPS protocol, it is set to a non-null value.
$_server[' REMOTE_ADDR '] The IP address of the user who browsed the current page.
$_server[' Remote_host '] The host name of the user who browsed the current page. DNS reverse resolution is not dependent on the user's remote_addr.
$_server[' Remote_port '] The port number used by the user's machine to connect to the WEB server.
$_server[' Script_filename '] The absolute path of the current execution script.
$_server[' Server_admin '] This value indicates the Server_admin parameter in the Apache server configuration file. If the script is running on a virtual host, the value is the value of that virtual host.
$_server[' Server_port '] The port used by the WEB server. The default value is "80". If SSL secured connection is used, this value is the HTTP port set by the user.
$_server[' Server_signature '] A string that contains the server version and the virtual host name.
$_server[' path_translated '] The base path of the file system (not the document root) where the current script resides. This is the result of the server making a virtual-to-real-path image.
$_server[' Script_name '] Contains the path to the current script. This is useful when the page needs to point to itself. The __FILE__ constant contains the full path and file name of the current script, such as the containing file.
$_server[' Script_uri '] The URI is used to specify the page to be accessed. For example, "/index.html".

The following is a user collation results, can refer to the next.

Server variable $_server Detailed:

1, $_session[' php_self ')--Gets the file name of the currently executing script

2, $_server[' Server_protocol ')--the name and version of the communication protocol when the page is requested. For example, "http/1.0".

3, $_server[' Request_time ')--timestamp at the beginning of the request. Valid from PHP 5.1.0. Is the same as the time function effect.

4, $_server[' argv ')--the parameters passed to the script. I tried, get method can get $_server[' argv '][0];post method can't give him value.

5, $_server[' server_name ')--Returns the current host name.

6, $_server[' Server_software ')--the string of the server identity, given in the header information in response to the request. such as microsoft-iis/6.0

7, $_server[' Request_method ')--the method of requesting access to the page. For example:, POST, PUT.

8. $_server[' query_string '--query string (the first question mark in the URL?) After the content).

9, $_server[' Document_root ')--the document root directory where the script is currently running. Defined in the server configuration file. such as E:\server

10, $_server[' http_accept ')--the current request of the ACCEPT: the content of the header information.

11, $_server[' Http_accept_charset ')--the accept-charset of the current request: the contents of the header information. For example: "Iso-8859-1,*,utf-8".

12, $_server[' http_accept_encoding ')--the accept-encoding of the current request: the contents of the header information. For example: "gzip".

13, $_server[' Http_accept_language ')--the accept-language of the current request: the contents of the header information. For example: "en".

14, $_server[' http_connection ')--the CONNECTION of the current request: the contents of the header information. For example: "Keep-alive".

15, $_server[' Http_host ')--the HOST of the current request: the contents of the header information.

16. $_server[' Http_referer ')--the URL address of the previous page that links to the current page.

17, $_server[' Http_user_agent ')--Returns the browser information used by the user. You can also use Get_browser () to get this information.

18, $_server[' https ')--if accessed through HTTPS, is set to a non-null value, otherwise returns off.

19, $_server[' REMOTE_ADDR ')--is browsing the current page user's IP address.

20, $_server[' remote_host '--the host name of the user who is browsing the current page. Reverse Domain name resolution is based on the user's remote_addr. If the local test returns 127.0.0.1

21, $_server[' Remote_port ')--the port that the user uses when connecting to the server. I did not pass the test in this machine, do not know what reason.

22, $_server[' Script_filename ')--the absolute path name of the current execution script. If you return to E:\server\index.php

23, $_server[' Server_admin ')--this value indicates the Server_admin parameter in the Apache server configuration file. If the script is running on a virtual host, the value is the value of that virtual host

24, $_server[' Server_port ')--the port used by the server. The default is "80". If SSL secured connection is used, this value is the HTTP port set by the user.

25, $_server[' server_signature ')--a string that contains the server version and the virtual host name.

26, $_server[' path_translated '--the basic path of the file system (not the document root) where the current script resides. This is the result of the server making a virtual-to-real-path image. Apache 2 users can use Acceptpathinfo on in httpd.conf to define PATH_INFO.

27, $_server[' Script_name ')--contains the path of the current script. This is useful when the page needs to point to itself. __FILE__ contains the absolute path and file name of the current file (for example, include files).

28, $_server[' Request_uri ')--the URI required to access this page. For example, "/index.html".

29, $_server[' Php_auth_digest ')--As for the Apache module runtime, during the HTTP DIGEST authentication process, this variable is set to the client sends the "Authorization" http The header content (for further authentication operations).

30, $_server[' Php_auth_user ']--when PHP is running in Apache or IIS (PHP 5 is ISAPI) module mode, and is using the HTTP authentication feature, this variable is the user name entered by the user.

31, $_server[' PHP_AUTH_PW ')--when PHP is running in Apache or IIS (PHP 5 is ISAPI) module mode, and is using the HTTP authentication function, this variable is the user entered the password.

32, $_server[' Auth_type ']--when PHP is running in the Apache module mode and is using the HTTP authentication feature, this variable is the type of authentication.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.