SlideShare une entreprise Scribd logo
1  sur  3
Server variables: $_SERVER
EX.URL: http://hp:86/ncdap/pro/ngodetails.php?
Ocode=130&page=1&section=1&name=&state=

$_SERVER is an array containing information such as headers,
paths, and script locations. The entries in this array are created by
the web server.

This is a 'superglobal', or automatic global, variable. This simply
means that it is available in all scopes throughout a script. You don't
need to do a global $_SERVER; to access it within functions or
methods, as you do with $HTTP_SERVER_VARS.



$_SERVER[‘PHP_SELF’]-> The filename of the currently executing script,
relative to the document root.

                            Ex. /ncdap/pro/ngodetails.php

$_SERVER['argv’] -> Array of arguments passed to the script.

                        Ex: Array ( [0] =>
Ocode=130&page=1&section=1&name=&state= )

$_SERVER['argc’] -> Contains the number of command line parameters passed to the
script (if run on the command line).

                            Ex: 1

$_SERVER['GATEWAY_INTERFACE’] -> What revision of the CGI specification the
               server is using; i.e. 'CGI/1.1'.
                       Ex: CGI/1.1]

$_SERVER['SERVER_ADDR’] ->The IP address of the server under which the current
                script is executing.

$_SERVER['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.

                            Ex: hp
$_SERVER[‘SERVER_SOFTWARE’] -> Server identification string, given in the
               headers when responding to requests.

                            Ex: Microsoft-IIS/6.0


$_SERVER[‘SERVER_SOFTWARE’] ->Name and revision of the information protocol
               via which the page was requested; i.e. 'HTTP/1.0';

                            Ex. HTTP/1.1


$_SERVER[‘REQUEST_METHOD’] -> Which request method was used to access the
page; i.e. 'GET', 'HEAD', 'POST', 'PUT'.

                                           Note: PHP script is terminated after sending
                                           headers (it means after producing any output
                                           without output buffering) if the request
                                           method was HEAD.


$_SERVER[‘QUERY_STRING’] -> The query string, if any, via which the page was
               accessed.

                            Ex: Ocode=130&page=1&section=1&name=&state=


$_SERVER[‘DOCUMENT_ROOT’] -> The document root directory under which the
               current script is executing, as defined in the server's configuration
               file.

                            Ex:    G:/projects/websites

$_SERVER[‘HTTP_HOST’] -> Contents of the Host: header from the current request, if
               there is one.

                            Ex: hp:86

$_SERVER[‘HTTP_USER_AGENT’] -> Contents of the User-Agent: header
                                           from the current request, if there is
                                           one. This is a string denoting the user
                                           agent being which is accessing the
                                           page. A typical example is:
Mozilla/4.5 [en] (X11; U;
                                       Linux 2.2.9 i586).

                    Ex: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
                                       rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7


$_SERVER[‘REMOTE_ADDR’] -> The IP address from which the user is viewing
                               the current page.


                       Ex: 192.168.0.23

$_SERVER[‘REMOTE_HOST’] -> The Host name from which the user is viewing the
                                 current page. The reverse dns lookup is
                                 based off the REMOTE_ADDR of the user.

                       Ex: 192.168.0.23

$_SERVER[‘REMOTE_PORT’] ->The port being used on the user's machine to
                                 communicate with the web server.

$_SERVER[‘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[‘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.


                        Ex: 86

Contenu connexe

Tendances

httpd — Apache Web Server
httpd — Apache Web Serverhttpd — Apache Web Server
httpd — Apache Web Server
webhostingguy
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
diego_k
 
Install ldap server
Install ldap serverInstall ldap server
Install ldap server
Mawardi 12
 
Nette framework (WebElement #28)
Nette framework (WebElement #28)Nette framework (WebElement #28)
Nette framework (WebElement #28)
Adam Štipák
 

Tendances (20)

httpd — Apache Web Server
httpd — Apache Web Serverhttpd — Apache Web Server
httpd — Apache Web Server
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Php functions
Php functionsPhp functions
Php functions
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rack
 
Docker & CoreOS at Utah Gophers
Docker & CoreOS at Utah GophersDocker & CoreOS at Utah Gophers
Docker & CoreOS at Utah Gophers
 
Service intergration
Service intergration Service intergration
Service intergration
 
Modern Perl
Modern PerlModern Perl
Modern Perl
 
Developing apps using Perl
Developing apps using PerlDeveloping apps using Perl
Developing apps using Perl
 
Php basics
Php basicsPhp basics
Php basics
 
Redis for your boss
Redis for your bossRedis for your boss
Redis for your boss
 
Redis for your boss 2.0
Redis for your boss 2.0Redis for your boss 2.0
Redis for your boss 2.0
 
Php server variables
Php server variablesPhp server variables
Php server variables
 
WP HTTP API
WP HTTP APIWP HTTP API
WP HTTP API
 
Install ldap server
Install ldap serverInstall ldap server
Install ldap server
 
RESTful web services
RESTful web servicesRESTful web services
RESTful web services
 
HTTP Caching and PHP
HTTP Caching and PHPHTTP Caching and PHP
HTTP Caching and PHP
 
Basics of Unix Adminisration
Basics  of Unix AdminisrationBasics  of Unix Adminisration
Basics of Unix Adminisration
 
HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係
 
Nette framework (WebElement #28)
Nette framework (WebElement #28)Nette framework (WebElement #28)
Nette framework (WebElement #28)
 

Similaire à Php Server Var

Running Head IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DIS.docx
Running Head IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DIS.docxRunning Head IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DIS.docx
Running Head IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DIS.docx
cowinhelen
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
King Foo
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Michael Peacock
 
Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Nginx - Tips and Tricks.
Nginx - Tips and Tricks.
Harish S
 
Apache server configuration & optimization
Apache server configuration & optimizationApache server configuration & optimization
Apache server configuration & optimization
Gokul Muralidharan
 

Similaire à Php Server Var (20)

Rack
RackRack
Rack
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 
Apache
ApacheApache
Apache
 
Language Resource Processing Configuration and Run
Language Resource Processing Configuration and RunLanguage Resource Processing Configuration and Run
Language Resource Processing Configuration and Run
 
Virtual hosting using nginx
Virtual hosting using nginxVirtual hosting using nginx
Virtual hosting using nginx
 
5-WebServers.ppt
5-WebServers.ppt5-WebServers.ppt
5-WebServers.ppt
 
Virtual host examples_-_apache_http_server
Virtual host examples_-_apache_http_serverVirtual host examples_-_apache_http_server
Virtual host examples_-_apache_http_server
 
4 Basic PHP
4 Basic PHP4 Basic PHP
4 Basic PHP
 
Running Head IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DIS.docx
Running Head IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DIS.docxRunning Head IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DIS.docx
Running Head IMPLEMENTING THE LIST AND SEARCH FEATURES IN THE DIS.docx
 
Mastering the AWS SDK for PHP (TLS306) | AWS re:Invent 2013
Mastering the AWS SDK for PHP (TLS306) | AWS re:Invent 2013Mastering the AWS SDK for PHP (TLS306) | AWS re:Invent 2013
Mastering the AWS SDK for PHP (TLS306) | AWS re:Invent 2013
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
 
Building drupal web farms with IIS - part 1
Building drupal web farms with IIS - part 1Building drupal web farms with IIS - part 1
Building drupal web farms with IIS - part 1
 
Session Server - Maintaing State between several Servers
Session Server - Maintaing State between several ServersSession Server - Maintaing State between several Servers
Session Server - Maintaing State between several Servers
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
 
Nginx + PHP
Nginx + PHPNginx + PHP
Nginx + PHP
 
IMPACT/myGrid Hackathon - Taverna Server as a Portal
IMPACT/myGrid Hackathon - Taverna Server as a PortalIMPACT/myGrid Hackathon - Taverna Server as a Portal
IMPACT/myGrid Hackathon - Taverna Server as a Portal
 
Node.js
Node.jsNode.js
Node.js
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
 
Nginx - Tips and Tricks.
Nginx - Tips and Tricks.Nginx - Tips and Tricks.
Nginx - Tips and Tricks.
 
Apache server configuration & optimization
Apache server configuration & optimizationApache server configuration & optimization
Apache server configuration & optimization
 

Php Server Var

  • 1. Server variables: $_SERVER EX.URL: http://hp:86/ncdap/pro/ngodetails.php? Ocode=130&page=1&section=1&name=&state= $_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_SERVER; to access it within functions or methods, as you do with $HTTP_SERVER_VARS. $_SERVER[‘PHP_SELF’]-> The filename of the currently executing script, relative to the document root. Ex. /ncdap/pro/ngodetails.php $_SERVER['argv’] -> Array of arguments passed to the script. Ex: Array ( [0] => Ocode=130&page=1&section=1&name=&state= ) $_SERVER['argc’] -> Contains the number of command line parameters passed to the script (if run on the command line). Ex: 1 $_SERVER['GATEWAY_INTERFACE’] -> What revision of the CGI specification the server is using; i.e. 'CGI/1.1'. Ex: CGI/1.1] $_SERVER['SERVER_ADDR’] ->The IP address of the server under which the current script is executing. $_SERVER['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. Ex: hp
  • 2. $_SERVER[‘SERVER_SOFTWARE’] -> Server identification string, given in the headers when responding to requests. Ex: Microsoft-IIS/6.0 $_SERVER[‘SERVER_SOFTWARE’] ->Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0'; Ex. HTTP/1.1 $_SERVER[‘REQUEST_METHOD’] -> Which request method was used to access the page; i.e. 'GET', 'HEAD', 'POST', 'PUT'. Note: PHP script is terminated after sending headers (it means after producing any output without output buffering) if the request method was HEAD. $_SERVER[‘QUERY_STRING’] -> The query string, if any, via which the page was accessed. Ex: Ocode=130&page=1&section=1&name=&state= $_SERVER[‘DOCUMENT_ROOT’] -> The document root directory under which the current script is executing, as defined in the server's configuration file. Ex: G:/projects/websites $_SERVER[‘HTTP_HOST’] -> Contents of the Host: header from the current request, if there is one. Ex: hp:86 $_SERVER[‘HTTP_USER_AGENT’] -> Contents of the User-Agent: header from the current request, if there is one. This is a string denoting the user agent being which is accessing the page. A typical example is:
  • 3. Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586). Ex: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7 $_SERVER[‘REMOTE_ADDR’] -> The IP address from which the user is viewing the current page. Ex: 192.168.0.23 $_SERVER[‘REMOTE_HOST’] -> The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user. Ex: 192.168.0.23 $_SERVER[‘REMOTE_PORT’] ->The port being used on the user's machine to communicate with the web server. $_SERVER[‘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[‘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. Ex: 86