Getenv () function

Source: Internet
Author: User
Tags http authentication http digest authentication
In PHP, The getenv (parameter) function is a function used to obtain environment variables. Different environment variables can be obtained based on different parameters. The details are as follows: "php_self" indicates the file name of the script being executed, which is related to document root. If php runs as a command line, this variable is invalid before PHP 4.3.0. Parameters passed to the script by argv. When the script runs in the command line mode, the argv variable is passed to the command line parameters in the C language style of the program. When the get method is called, the variable contains the requested data. "Argc" contains the number of command line parameters passed to the Program (if running in command line mode ). The version of the CGI specification used by the gateway_interface server. For example, "cgi/1.1 ". "SERVER_NAME" indicates the name of the server host where the script is currently running. If the script runs on a VM, the name is determined by the value set by that VM. The string of the "server_software" server identifier, which is provided in the header information in the Response Request. The name and version of the communication protocol when "server_protocol" Requests the page. For example, "HTTP/1.0 ". "Request_method" is the request method used to access the page. For example, "get", "head", "Post", and "put ". Note: If the request method is head, the PHP script will stop sending the header information (this means no output buffer is available after any output is generated ). The timestamp at the start of the "request_time" request. Valid from PhP 5.1.0. "QUERY_STRING" refers to the query string (the first question mark in the URL? ). "Document_root" indicates the root directory of the document where the script is currently running. Defined in the server configuration file. "Http_accept" indicates the accept of the current request: the content of the header information. "Http_accept_charset" indicates the accept-charset of the current request. Example: "iso-8859-1, *, UTF-8 ". "Http_accept_encoding" indicates the accept-encoding of the current request. For example, "gzip ". "Http_accept_language" indicates the content of the Accept-Language header of the current request. For example, "en ". "Http_connection": the connection of the current request: the content of the header information. For example, "keep-alive ". "Http_host": the host of the current request: the content of the header information. "Http_referer" link to the URL of the previous page of the current page. Not all user proxies (browsers) will set this variable, and some can also manually modify http_referer. Therefore, this variable is not always true and correct. "Http_user_agent": the User-Agent of the current request: the content of the header information. This string indicates the information of the User Agent accessing the page. A typical example is Mozilla/4.5 [En] (X11; U; Linux 2.2.9 i586 ). You can also use get_browser () to obtain this information. "HTTPS" is set to a non-empty value if the script is accessed through the HTTPS protocol. "Remote_addr" is browsing the IP address of the user on the current page. "Remote_host" is browsing the host name of the user on the current page. Reverse Domain name resolution is based on the user's remote_addr. Note: You must configure the Web server to create this variable. For example, Apache needs to include hostnamelookups on in httpd. conf. See gethostbyaddr (). The port used by the "remote_port" user to connect to the server. "Script_filename" indicates the absolute path name of the currently executed script. Note: If the script is executed in CLI, it is used as a relative path, such as file. PHP or .. /file. PHP, $ _ server ['script _ filename'] will contain the relative path specified by the user. "Server_admin" indicates the server_admin parameter in the Apache server configuration file. If the script runs on a VM, this value is the value of that VM. The port used by the "server_port" server. The default value is "80 ". If SSL secure connection is used, this value is the http port set by the user. "Server_signature" contains the server version and virtual host name strings. "Path_translated" is the basic path of the file system (not the document root directory) where the current script is located. This is the result of a virtual image to a real path on the server. Note: After PHP 4.3.2, path_translated does not implicitly assign values like Apache 1 in Apache 2 SAPI mode. If Apache does not generate this value, PHP generates and puts the value in the script_filename server constant. This modification complies with CGI specifications. path_translated exists only under the conditions defined by path_info. Apache 2 users can use acceptpathinfo on in httpd. conf to define path_info. "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, including the file ). The URI required for "request_uri" to access this page. For example, "/index.html ". "Php_auth_digest" is used as an Apache module for HTTP digest authentication, this variable is set to the "Authorization" HTTP header content sent by the client (For further authentication ). "Php_auth_user" when PHP runs in Apache or IIS (PHP 5 is an ISAPI) module and uses the HTTP authentication function, this variable is the user name entered by the user. "Php_auth_pw" when PHP runs in the Apache or IIS (PHP 5 is an ISAPI) module and is using the HTTP authentication function, this variable is the password entered by the user.

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.