Sure! These variables are typically found in web server environments like Apache or IIS and are used by server-side applications (like PHP, Python, ASP.NET, etc.) to understand request data, file paths, and configuration settings.
Below is an explanation of each with examples where applicable.
✅ URL & Request Related Variables
1. CACHE_URL
- 
Description: IIS-specific; relates to cached URLs in output caching.
 - 
Example:
/cached-page.html - 
Use: Used internally by IIS for cached content lookup.
 
2. DOCUMENT_ROOT
- 
Description: The absolute path to the root directory for the web server (where web content is served from).
 - 
Example:
C:/inetpub/wwwroot(Windows IIS)
/var/www/html(Apache/Linux) 
3. HTTP_URL
- 
Description: Often a custom environment variable; not always standard. Could represent the full HTTP URL.
 - 
Example:
http://example.com/index.php?user=123 
4. HTTP_HOST
- 
Description: Host header sent by the client.
 - 
Example:
www.example.com 
5. PATH_INFO
- 
Description: Extra path information provided after the script name in the URL.
 - 
Example: If URL is
/index.php/user/123, and script isindex.php, then:
PATH_INFO = /user/123 
6. PATH_TRANSLATED
- 
Description: Filesystem path equivalent to
PATH_INFO. - 
Example:
C:/inetpub/wwwroot/user/123 
7. QUERY_STRING
- 
Description: The query string part of the URL after the
?. - 
Example:
For/index.php?id=10&name=John,
QUERY_STRING = id=10&name=John 
8. REQUEST_FILENAME
- 
Description: The absolute file path to the script being executed.
 - 
Example:
/var/www/html/index.php 
9. REQUEST_URI
- 
Description: The full URI as requested by the client, including path and query string.
 - 
Example:
/index.php?user=123 
10. SCRIPT_FILENAME
- 
Description: The absolute path to the script being executed (like
index.php). - 
Example:
C:/inetpub/wwwroot/index.php 
11. SCRIPT_NAME
- 
Description: The relative path to the script from the root of the website.
 - 
Example:
/index.php 
12. SCRIPT_TRANSLATED
- 
Description: IIS-specific variable; maps the requested URI to a physical path.
 - 
Example:
If URL is/foo/bar,
SCRIPT_TRANSLATED = C:\inetpub\wwwroot\foo\bar 
13. UNENCODED_URL
- 
Description: IIS variable; shows the original URL before encoding.
 - 
Example:
/path with space/file.html(not URL-encoded) 
14. URL
- 
Description: IIS variable; the URL portion of the request.
 - 
Example:
/index.php 
15. URL_PATH_INFO
- 
Description: IIS variable; similar to
PATH_INFO, often used in ISAPI applications. - 
Example:
/extra/path/data 
✅ IIS or Application Pool Related Variables
16. APP_POOL_ID
- 
Description: Name of the IIS Application Pool that is processing the request.
 - 
Example:
DefaultAppPool 
17. APPL_MD_PATH
- 
Description: The IIS metabase path for the application.
 - 
Example:
/LM/W3SVC/1/ROOT 
18. APPL_PHYSICAL_PATH
- 
Description: Physical file system path to the application root.
 - 
Example:
C:\inetpub\wwwroot\myapp\ 
19. GATEWAY_INTERFACE
- 
Description: The version of the Common Gateway Interface (CGI) used.
 - 
Example:
CGI/1.1 
20. SERVER_SOFTWARE
- 
Description: The name and version of the server software.
 - 
Example:
Microsoft-IIS/10.0
or
Apache/2.4.41 (Unix) 
21. SSI_EXEC_DISABLED
- 
Description: IIS-specific; indicates that execution of commands via Server Side Includes (SSI) is disabled.
 - 
Example:
trueorfalse 
✅ Summary Table
| Variable | Description | Example | 
|---|---|---|
CACHE_URL | Cached URL used by IIS | /page.html | 
DOCUMENT_ROOT | Web root path | C:/inetpub/wwwroot | 
HTTP_URL | Full URL (not standard) | http://example.com/path | 
HTTP_HOST | Domain name from Host header | example.com | 
PATH_INFO | Extra path after script | /user/123 | 
PATH_TRANSLATED | Filesystem path from PATH_INFO | C:/.../user/123 | 
QUERY_STRING | URL query string | id=5&name=test | 
REQUEST_FILENAME | Full file path to requested file | /var/www/index.php | 
REQUEST_URI | Entire URI sent by client | /index.php?x=1 | 
SCRIPT_FILENAME | Full file path of the script | C:/.../index.php | 
SCRIPT_NAME | Relative path to the script | /index.php | 
SCRIPT_TRANSLATED | Mapped physical path of script (IIS) | C:/.../foo/bar | 
UNENCODED_URL | Original URL before encoding (IIS) | /path with space/ | 
URL | URL part of the request (IIS) | /index.php | 
URL_PATH_INFO | Extra path info (IIS) | /info/here | 
APP_POOL_ID | Name of the app pool (IIS) | DefaultAppPool | 
APPL_MD_PATH | IIS metabase path | /LM/W3SVC/1/ROOT | 
APPL_PHYSICAL_PATH | Physical path to application | C:/inetpub/... | 
GATEWAY_INTERFACE | CGI version | CGI/1.1 | 
SERVER_SOFTWARE | Web server name/version | IIS/10.0 | 
SSI_EXEC_DISABLED | Whether SSI execution is disabled (IIS) | true | 
No comments:
Post a Comment