If you like SEOmastering Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Apache variables

Started by chinmay.sahoo, 05-24-2016, 04:07:43

Previous topic - Next topic

chinmay.sahooTopic starter

Apache keeps track of dozens of variables. We can't include a complete list of them here, as the variables you use will vary depending on your current setup. Here are some of the ones you might use frequently in your scripts.

As you look at this list and phpinfo(), keep in mind that if you are not getting what you want out of your Web server variables, you will need to make changes to your server configuration, not PHP. PHP just passes the information along and cannot alter these variables. There is also a fair amount of overlap between PHP and Apache variables. These are also available as keys of the $_SERVER array variable.


grace01

Apache HTTP Server is a robust piece of software which offers a lot of configuration options through the use of variables. Here are some of the important ones:

${dоcument_ROOT}: This variable contains the value defined in the Server's dоcumentRoot directive. It references the directory out of which you will serve your dоcuments.

${SERVER_ADMIN}: It contains the value of ServerAdmin directive. This address appears on some server-generated pages, such as error dоcuments.

${SERVER_NAME}: The SERVER_NAME variable is set to the server's hostname, local IP address or your server's fully qualified domain name (FQDN). It is used to resolve the value for ServerName directive.

${SERVER_PORT}: SERVER_PORT is used to store the port on which the request was received.

${REMOTE_ADDR}: REMOTE_ADDR variable is used to store the IP address from which the request was received.

${REQUEST_URI}: REQUEST_URI variable stores the URI which was given in order to access the page.

${REQUEST_METHOD}: It contains the HTTP method (like GET, POST, HEAD, etc.) used to make the request.

${QUERY_STRING}: This stores the query (GET) string, if it exists. A query string is a part of a URL, sent to a server to send small amounts of data.

${HTTP_USER_AGENT}: This represents the User-Agent string that is sent in the HTTP request header. It may be used to make specific configurations based on the client's browser or device.

${HTTP_REFERER}: It holds the address of the webpage that linked to the server's resource. This can be useful for tracking how users are navigating to your site.

${HTTP_COOKIE}: HTTP_COOKIE stores the cookie header, which can be used to maintain state for a client session.

${HTTPS}: This environment variable is a simple way to check if the request was made over HTTPS or not. If the request was made over a secure connection, ${HTTPS} would contain a non-empty string.

${REMOTE_USER}: If the incoming request has been authenticated, the ${REMOTE_USER} will be populated with the username.

${IS_SUBREQ}: This holds a string value (usually "true" or "false") indicating whether the current request is a subrequest (yes) or the original client request (no). Subrequests may be internally generated for various reasons, such as by the "include" or "rewrite" modules.

${REQUEST_URI}: This variable contains the raw, undecoded URL as it was requested by the client. This can be useful for logs, or for redirect/rewrite rules to retain the original URL encoding.

${THE_REQUEST}: This variable contains the first line of the HTTP request and typically includes the HTTP method, the request URI and the protocol version.

${REQUEST_METHOD}: Contains the method used in the request, such as GET, POST, PUT, DELETE, HEAD, OPTIONS, etc.

${SCRIPT_FILENAME}: Full filesystem path to the script or file being invoked. This is different than dоcument_ROOT and REQUEST_URI as those will provide the URL path.

${LIMIT}: Shows the current limit level if, and only if, the request has been processed for such a level. Values might include "none", "unlimited", "method" (received request line and headers), "authname", "authrequirement", or "fileowner".

${QUERY_STRING}: This variable holds the query string (part of URL after "?") sent by the client if there is one.

${REMOTE_HOST}: Provides the host name of the client machine making the request, if available.

${REMOTE_ADDR}: Offers the IP address of the client machine making the request.

${SERVER_PROTOCOL}: This contains the name and revision of the information protocol via which the page was requested. Examples may include "HTTP/1.0" or "HTTP/1.1".

${REMOTE_PORT}: This contains the port number from which the client is sending the request.

${SERVER_NAME}: It offers the server's hostname, DNS alias, or IP address as it would appear in self-referenced URLs.

${SERVER_PORT}: Contains the port on the server machine being used by the web service.

${HTTPS}: Is 'on' if the connection is using SSL/TLS, otherwise it's 'off'.

${HTTP_USER_AGENT}: The User-Agent header field of the request. This identifies the client or the software that is making the request.

${HTTP_REFERER}: The Referer header field. This identifies the address (URL) of the web page that linked to the resource being requested.

${HTTP_COOKIE}: If the client sent a Cookie header, this variable is populated with its contents.

${SERVER_ADMIN}: The value set for the ServerAdmin (for example, webmaster@hostname.com) directive in the web server's configuration file. This will be the email address of the server's administrator.

${THE_REQUEST}: The raw, unparsed request line, such as "GET /index.html HTTP/1.1".

${dоcument_ROOT}: The value of the dоcument root directory under which the current script is executing, as defined in the server's configuration file.

${SCRIPT_FILENAME}: The absolute pathname of the currently executing script.

${REQUEST_METHOD}: The HTTP request method; for example, "GET", "POST".

${SCRIPT_NAME}: Contains the current script's path, relative to the dоcument root.

${QUERY_STRING}: The query string (if any) that was sent with the URL when the page was accessed.

${REMOTE_ADDR}: The IP address of the remote client making the request.

${REMOTE_PORT}: The client's port from which it made the request.

${SERVER_SIGNATURE}: The server-generated string which, if it is turned on, contains the server version and virtual host name.

${PATH_TRANSLATED}: A version of ${SCRIPT_FILENAME} where the /~user part is replaced with the user's home directory, as per the Unix-style path translation.

${AUTH_TYPE}: The type of authentication being used, if any.

${CONTENT_LENGTH}: The length of the request body in bytes, if there is any.

${CONTENT_TYPE}: The media type of the data being sent with the request, if any.
  •  


If you like SEOmastering Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...