Home Tutorial Php List php list all server variables

 
 

Share on Google+Share on Google+
php list all server variables
Posted on: October 31, 2009 at 12:00 AM
Advertisement
In this section of the tutorial we will learn how to get all server variables. And we will also see the example related to it.

  • PHP list All server variables is present in the $_SERVER environment variables.
  • Using the for each loop all keys and values can be accessed


Example of PHP List all Server

<?php
    print
"<table border=0>";
    foreach
($_SERVER as $key=>$val )
       {
         echo
"<tr><td>".$key."</td><td>" .$val."</tr>";
        }
    print
"</table>";
?>

Output

AuthDigestEnableQueryStringHack On
UNIQUE_ID SuvhL8CoCgcAAArYGIgAAAD3
HTTP_ACCEPT */*
HTTP_ACCEPT_LANGUAGE en-us
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; msn OptimizedIE8;ENUS)
HTTP_HOST localhost
HTTP_CONNECTION Keep-Alive
PATH C:\XEClient\bin;C:\XEClient\bin;C:\XEClient\bin;C:\WINDOWS\System32;c:\Program Files\java\jdk1.6.0_11\bin;c:\apache-maven-2.1.0-bin\bin;C:\Java2HTML;;c:\Program Files\java\jdk1.6.0_11\bin;c:\apache-maven-2.1.0-bin\bin;C:\Java2HTML;;c:\Program Files\java\jdk1.6.0_11\bin;c:\apache-maven-2.1.0-bin\bin;C:\Java2HTML;
SystemRoot C:\WINDOWS
COMSPEC C:\WINDOWS\system32\cmd.exe
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
WINDIR C:\WINDOWS
SERVER_SIGNATURE
Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9 Server at localhost Port 80
SERVER_SOFTWARE Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9
SERVER_NAME localhost
SERVER_ADDR 127.0.0.1
SERVER_PORT 80
REMOTE_ADDR 127.0.0.1
DOCUMENT_ROOT C:/xampp/htdocs
SERVER_ADMIN admin@localhost
SCRIPT_FILENAME C:/xampp/htdocs/list/allservervariables.php
REMOTE_PORT 1360
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING
REQUEST_URI /list/allservervariables.php
SCRIPT_NAME /list/allservervariables.php
PHP_SELF /list/allservervariables.php
REQUEST_TIME 1256972591
argv Array
argc 0

 

Advertisement

Related Tags for php list all server variables:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 31, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com