From f3b110a2803842578ed98e5768dddcf4f1797467 Mon Sep 17 00:00:00 2001 From: irc-html Date: Thu, 10 Jan 2002 03:09:49 +0000 Subject: [PATCH] Incremental update for list of predefined variables and constants. Please don't link or translate, just copied over the information from the chapter sections. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@67482 c90b9560-bf6c-de11-be94-00142212c4b1 --- appendices/predefined.xml | 615 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 615 insertions(+) create mode 100644 appendices/predefined.xml diff --git a/appendices/predefined.xml b/appendices/predefined.xml new file mode 100644 index 0000000000..c494a962fe --- /dev/null +++ b/appendices/predefined.xml @@ -0,0 +1,615 @@ + + + +<-- Note: Please do not link or translate this file yet. +This is only an initial update, quite a few more commits will +follow for this appendix. --> + + + + List of Predefined Variables and Constants + + The following is a listing of predefined variables and + and constants. These lists are neither exhaustive or complete. + + + + Listing of Predefined Variables + + + Apache variables + + + These variables are created by the Apache webserver. If you are running + another webserver, there is no guarantee that it will provide the + same variables; it 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. + + + Note that few, if any, of these will be available (or indeed have + any meaning) if running PHP on the command line. + + + + + + $GATEWAY_INTERFACE + + + What revision of the CGI specification the server is using; + i.e. 'CGI/1.1'. + + + + + + $SERVER_NAME + + + 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_SOFTWARE + + + Server identification string, given in the headers when + responding to requests. + + + + + + $SERVER_PROTOCOL + + + Name and revision of the information protocol via which the + page was requested; i.e. 'HTTP/1.0'; + + + + + + $REQUEST_METHOD + + + Which request method was used to access the page; i.e. 'GET', + 'HEAD', 'POST', 'PUT'. + + + + + + $QUERY_STRING + + + The query string, if any, via which the page was accessed. + + + + + + $DOCUMENT_ROOT + + + The document root directory under which the current script is + executing, as defined in the server's configuration file. + + + + + + $HTTP_ACCEPT + + + Contents of the Accept: header from the + current request, if there is one. + + + + + + $HTTP_ACCEPT_CHARSET + + + Contents of the Accept-Charset: header + from the current request, if there is one. Example: + 'iso-8859-1,*,utf-8'. + + + + + + $HTTP_ACCEPT_ENCODING + + + Contents of the Accept-Encoding: header + from the current request, if there is one. Example: 'gzip'. + + + + + + $HTTP_ACCEPT_LANGUAGE + + + Contents of the Accept-Language: header + from the current request, if there is one. Example: 'en'. + + + + + + $HTTP_CONNECTION + + + Contents of the Connection: header from + the current request, if there is one. Example: 'Keep-Alive'. + + + + + + $HTTP_HOST + + + Contents of the Host: header from the + current request, if there is one. + + + + + + $HTTP_REFERER + + + The address of the page (if any) which referred the browser + to the current page. This is set by the user's browser; not + all browsers will set this. + + + + + + $HTTP_USER_AGENT + + + Contents of the User_Agent: header from + the current request, if there is one. This is a string + denoting the browser software being used to view the current + page; i.e. Mozilla/4.5 [en] (X11; U; Linux + 2.2.9 i586). Among other things, you can use + this value with get_browser to tailor + your page's functionality to the capabilities of the user's + browser. + + + + + + $REMOTE_ADDR + + + The IP address from which the user is viewing the current + page. + + + + + + $REMOTE_PORT + + + The port being used on the user's machine to communicate with + the web server. + + + + + + $SCRIPT_FILENAME + + + The absolute pathname of the currently executing script. + + + + + + $SERVER_ADMIN + + + The value given to the SERVER_ADMIN (for Apache) directive in + the web server configuration file. If the script is running + on a virtual host, this will be the value defined for that + virtual host. + + + + + + $SERVER_PORT + + + The port on the server machine being used by the web server + for communication. For default setups, this will be '80'; + using SSL, for instance, will change this to whatever your + defined secure HTTP port is. + + + + + + $SERVER_SIGNATURE + + + String containing the server version and virtual host name + which are added to server-generated pages, if enabled. + + + + + + $PATH_TRANSLATED + + + Filesystem- (not document root-) based path to the current + script, after the server has done any virtual-to-real + mapping. + + + + + + $SCRIPT_NAME + + + Contains the current script's path. This is useful for pages + which need to point to themselves. + + + + + + $REQUEST_URI + + + The URI which was given in order to access this page; for + instance, '/index.html'. + + + + + + + + + + Environment variables + + + These variables are imported into PHP's global namespace from the + environment under which the PHP parser is running. Many are + provided by the shell under which PHP is running and different + systems are likely running different kinds of shells, a + definitive list is impossible. Please see your shell's + documentation for a list of defined environment variables. + + + Other environment variables include the CGI variables, placed + there regardless of whether PHP is running as a server module or + CGI processor. + + + + + + PHP variables + + + These variables are created by PHP itself. The + $HTTP_*_VARS variables are available only if + the track_vars + configuration is turned on. When enabled, the variables are + always set, even if they are empty arrays. This prevents + a malicious user from spoofing these variables. + + + + + As of PHP 4.0.3, track_vars is always turned on, + regardless of the configuration file setting. + + + + + If the register_globals directive + is set, then these variables will also be made available in the + global scope of the script; i.e., separate from the + $HTTP_*_VARS arrays. This feature should be + used with care, and turned off if possible; while the + $HTTP_*_VARS variables are safe, the bare + global equivalents can be overwritten by user input, with + possibly malicious intent. If you cannot turn off register_globals, you must + take whatever steps are necessary to ensure that the data you are + using is safe. + + + + + + $argv + + + Array of arguments passed to the script. When the script is + run on the command line, this gives C-style access to the + command line parameters. When called via the GET method, this + will contain the query string. + + + + + + $argc + + + Contains the number of command line parameters passed to the + script (if run on the command line). + + + + + + $PHP_SELF + + + The filename of the currently executing script, relative to + the document root. If PHP is running as a command-line + processor, this variable is not available. + + + + + + $HTTP_COOKIE_VARS + + + An associative array of variables passed to the current + script via HTTP cookies. + + + + + + $HTTP_GET_VARS + + + An associative array of variables passed to the current + script via the HTTP GET method. + + + + + + $HTTP_POST_VARS + + + An associative array of variables passed to the current + script via the HTTP POST method. + + + + + + $HTTP_POST_FILES + + + An associative array of variables containing information + about files uploaded via the HTTP POST method. See POST method + uploads for information on the contents of + $HTTP_POST_FILES. + + + $HTTP_POST_FILES is available only in PHP + 4.0.0 and later. + + + + + + $HTTP_ENV_VARS + + + An associative array of variables passed to the current + script via the parent environment. + + + + + + $HTTP_SERVER_VARS + + + An associative array of variables passed to the current + script from the HTTP server. These variables are analogous to + the Apache variables described above. + + + + + + + + + + + + Listing of Predefined Constants + + The predefined constants (always available) are: + + + + + __FILE__ (case-insensitive) + + + The name of the script file presently being parsed. If used + within a file which has been included or required, then the + name of the included file is given, and not the name of the + parent file. + + + + + + __LINE__ (case-insensitive) + + + The number of the line within the current script file which is + being parsed. If used within a file which has been included or + required, then the position within the included file is given. + + + + + + PHP_VERSION + + + The string representation of the version of the PHP parser + presently in use; for example '4.1.0'. + + + + + + PHP_OS + + + The name of the operating system on which the PHP parser is + executing;. Possible values may be : + "AIX", "Darwin" (MacOS), "Linux", "SunOS", "WIN32", "WINNT". + Note: other values may be available too. + + + + + + &true; (case-insensitive) + + + A &true; value (see the boolean type). + + + + + + &false; (case-insensitive) + + + A &false; value (see the boolean type). + + + + + + &null; (case-insensitive) + + + A &null; value (see the null type). + + + + + + E_ERROR + + + Denotes an error other than a parsing error from which + recovery is not possible. + + + + + + E_WARNING + + + Denotes a condition where PHP knows something is wrong, but + will continue anyway; these can be caught by the script + itself. An example would be an invalid regexp in + ereg. + + + + + + E_PARSE + + + The parser choked on invalid syntax in the script + file. Recovery is not possible. + + + + + + E_NOTICE + + + Something happened which may or may not be an error. Execution + continues. Examples include using an unquoted string as an array + index, or accessing a variable which has not been set. + + + + + + E_ALL + + + All of the E_* constants rolled into one. If used with + error_reporting, will cause any and all + problems noticed by PHP to be reported. + + + + + + + + + + +