- Forums
- PHP
- Example Output of $_SERVER in PHP
this page will show you all the values you can use on each element of the $_server array in php system which shows you each detail you want to know and what the value is for each element in the array and also a script includes how to use it [2106], Last Updated: Mon Jun 24, 2024
Padaki52
Thu Oct 07, 2010
1 Comments
805 Visits
i often have to use this code on my scripts to find out the values for each element in the $_SERVER() array,
this is the code i use:
echo '<PRE>';print_r($_SERVER);echo '</PRE>';
and this is the output i get when i execute this code:
Array
(
[HTTP_HOST] => localhost
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip,deflate
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
[HTTP_KEEP_ALIVE] => 115
[HTTP_CONNECTION] => keep-alive
[HTTP_CACHE_CONTROL] => max-age=0
[PATH] => C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
[SystemRoot] => C:\Windows
[COMSPEC] => C:\Windows\system32\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
[WINDIR] => C:\Windows
[SERVER_SIGNATURE] =>
Apache/2.0.52 (Win32) mod_ssl/2.0.52 OpenSSL/0.9.7c PHP/5.0.3RC2-dev Server at localhost Port 80
[SERVER_SOFTWARE] => Apache/2.0.52 (Win32) mod_ssl/2.0.52 OpenSSL/0.9.7c PHP/5.0.3RC2-dev
[SERVER_NAME] => localhost
[SERVER_ADDR] => 127.0.0.1
[SERVER_PORT] => 80
[REMOTE_ADDR] => 127.0.0.1
[DOCUMENT_ROOT] => C:/apachefriends/xampp/htdocs
[SERVER_ADMIN] => admin@localhost
[SCRIPT_FILENAME] => C:/apachefriends/xampp/htdocs/testscripts/javascript/compressed_files/Ver2/com/update.php
[REMOTE_PORT] => 57035
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /testscripts/javascript/compressed_files/ver2/com/update.php
[SCRIPT_NAME] => /testscripts/javascript/compressed_files/ver2/com/update.php
[PHP_SELF] => /testscripts/javascript/compressed_files/ver2/com/update.php
)
https://www.webune.com/forums/20101007cgfr.html