Important SERVER Variables in PHP - By PHP Expert


Consider your file is at location: http://www.example.com/index.php
static location for file is: /home/a/b/exampl/htdocs/
The following will be the values for the server variables

[HTTP_HOST] => www.example.com
//Indicates the domain name of your site

[HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
// Indicates from which browser you are accessing the site

[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
//what kind of content is requested by your file

[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
//header from the current request, if there is one. Example \'en\'

[HTTP_ACCEPT_ENCODING] => gzip,deflate
//header from the current request, if there is one. Example: \'gzip\'

[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
//header from the current request, if there is one. Example: \'iso-8859-1,*,utf-8\'

[HTTP_KEEP_ALIVE] => 300
//header from the current request, if there is one to keep connection alive for given time.

[HTTP_CONNECTION] => keep-alive
//header from the current request, indicating whether to keep connection alive or not.

[HTTP_COOKIE] => __utma=123129419.826544571.1217935577.1219399309.1219416030.12; __utmz=123129419.1217935577.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); style=alt1

//shows the list of cookies currently set.

[HTTP_CACHE_CONTROL] => max-age=0
//amount for which we browser must control cache, its 0 means for unlimited period.

[PATH] => /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin

[SERVER_SIGNATURE] => Apache/2.0.52 (CentOS) Server at 192.168.1.101 Port 80
// Information about the webserver

[SERVER_SOFTWARE] => Apache/2.0.52 (CentOS)
//Information about the server software

[SERVER_NAME] => www.example.com
//The name of the server host under which the current script is executing.

[SERVER_ADDR] => 192.168.1.101
//The IP address of the server under which the current script is executing.

[SERVER_PORT] => 80 //The port on the server machine being used by the web server for communication.

[REMOTE_ADDR] => 192.168.1.178
//The Host name from which the user is viewing the current page.

[DOCUMENT_ROOT] => /home/a/b/exampl/htdocs/
//The document root directory under which the current script is executing, as defined in the server\'s configuration file.

[SERVER_ADMIN] => root@localhost
//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.

[SCRIPT_FILENAME] => /home/a/b/exampl/htdocs/index.php
//The absolute pathname of the currently executing script.

[REMOTE_PORT] => 3924
//The port being used on the user\'s machine to communicate with the web server.

[GATEWAY_INTERFACE] => CGI/1.1
//What revision of the CGI specification the server is using; i.e. \'CGI/1.1\'.

[SERVER_PROTOCOL] => HTTP/1.1
//Name and revision of the information protocol via which the page was requested; i.e. \'HTTP/1.0\';

[REQUEST_METHOD] => GET
// 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.

[REQUEST_URI] => /
//The URI which was given in order to access this page; for instance, \'/index.php\'.

[SCRIPT_NAME] => /index.php
//Contains the current script\'s path. This is useful for pages which need to point to themselves. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.

[PHP_SELF] => /index.php
//The filename of the currently executing script, relative to the document root.

[REQUEST_TIME] => 1219654851
//The timestamp of the start of the request. Available since PHP 5.1.0.

kevin@sdi.la
2008-09-05 06:52:41
Hi Nilesh, Just testing.
lavina@sdi.la
2008-09-02 02:57:45
test

Enter your email address:

Delivered by FeedBurner

OR

 Subscribe in a reader

 
jQuery UI provides a comprehen
 
Program Plan   I drafted a p
 
I present to you my skills, ac
 
Introduction One of the issue
 
If you are a PHP developer and
 
cURL is a great tool to help y
 
cformsII cforms is a powerful
 
  The lack of Unicode su
 
History PHP-GTK was origina
 
Performance on the web is stra
 
Listen t
 
What\'s the number one cost in
 
When you\'re discussing the In
 
Classe
 
A service-oriented architectur
 
Introduc
 
PHP Crons and Linux Linux has
 
Cross site scripting (XSS) is
 
What Makes a Web 2.0 Applicati
 
As you develop web application
 
Cryptogr
 
Posting
 
Have you
 
Resources The Google API - ht
 
Get Started
 
Output B
 
If you r
 
PHP has some really sweet new
 
There were some new php.ini di
 
In PHP 5 there are some new fu
 
The following code implements
 
The following code snippet imp
 
A fine implementation of the o
 
Exception handling PHP 5 adds
 
Support for dereferencing obje
 
Static members Classes defini
 
Explicit object cloning In or
 
final methods The final keywo
 
Interfaces Gives the ability
 
The new object oriented featur
 
Sometimes its the little thing
 
Consider your file is at locat
 
# If a method can be static, d