home

Php Server Tutorial


The $_SERVER superglobal contains useful information about the web server.

As for any other superglobal, you can print out its content using print_r() and <pre>

<?php 
//displaying $_SERVER content
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
/*
Array
(
[DB_USER] => ***
[DB_PASS] => ***
[HTTP_HOST] => localhost:8888
[HTTP_USER_AGENT] => Mozilla/5.0 ...
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;****
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_CONNECTION] => ....
[HTTP_COOKIE] => PHPSESSID=***
[PATH] => ....
[SERVER_SIGNATURE] => Apache/2.0.63 (Unix) PHP/5.3.2 ...
[SERVER_SOFTWARE] => Apache/2.0.63 (Unix) PHP/5.3.2 ...
[SERVER_NAME] => localhost
[SERVER_ADDR] => ***
[SERVER_PORT] => 8888
[REMOTE_ADDR] => ***
[DOCUMENT_ROOT] => /Applications/MAMP/htdocs
[SERVER_ADMIN] => you@example.com
[SCRIPT_FILENAME] => /Applications/MAMP/htdocs/STUDIO/PHP/tests.php
[REMOTE_PORT] => ***
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /STUDIO/PHP/tests.php
[SCRIPT_NAME] => /STUDIO/PHP/tests.php
[PHP_SELF] => /STUDIO/PHP/tests.php
[REQUEST_TIME] => ...
)

*/

?>

 


Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Copyright © 2014 by Cramerz.com.