Saturday, January 24, 2009

Server Information in PHP

In Php $_SERVER array contains a lot of useful informatiom from the webserver. For CGI specification infomation comes from the environment variables

Here is the list of entries in $_SERVER that comes from CGI

1. SERVER_SOFTWARE: A string that identifies the server.

2. SERVER_NAME: The host name, DNS alias, or IP Address for self referencing URL ex(www.php.com)

3. GATEWAY_INTERFACE: The version of the CGI standard being followed(e.g. CGI 1.1)

4. SERVER_PROTOCOL: The name and revision of the requested protocol(e.g. HTTP/1.1)

5. SERVER_PORT: The server port number to which the request was sent(e.g 80 or 85)

6. REQUEST_METHOD: The method the client used to fetch the document(e.g. GET)

7. PATH_INFO: Extra path elements given by the client(e.g. list/users)

8. PATH_TRANSLATED: The value of PATH_INFO, translated by the server into a filename (e.g home/httpd/htdocs/list/users)

9. SCRIPT_NAME: The URL Path of the current page, which is useful for self-referencing scripts (e.g /foldername/filename.php)

10. QUERY_STRING: Everything after the ? in the URL(e.g filename.php?filename=test)

11. REMOTE_ADDR: A string containg the IP address of the machine that requested this page (e.g 192.168.1.100)

0 comments:

Post a Comment