You are on page 1of 10

$_SERVER

&
$_REQUEST
$_SERVER

$_SERVER is a PHP super global variable which


holds information about headers, paths, and script
locations.
$_SERVER has following
basic properties:
1. Set by web server.

2. Directly related to the runtime environment of the


current PHP script.

3. It does the same job as $HTTP_SERVER_VARS used to


do in previous versions of PHP
Sample output of $_SERVER taken
from Local host
• PHP : $_SERVER['PHP_SELF']
• PHP : $_SERVER[‘ argv']
• PHP : Super global variable: $ argc
• PHP : $_SERVER['GATEWAY_INTERFACE']
• PHP : $_SERVER['SERVER_ADDR']
• PHP : $_SERVER['SERVER_NAME']
• PHP : $_SERVER['SERVER_SOFTWARE']
• PHP : $_SERVER['SERVER_PROTOCOL']
• PHP : $_SERVER['REQUEST_METHOD']
• PHP : $_SERVER['REQUEST_TIME']
• PHP : $_SERVER['QUERY_STRING']
• PHP : $_SERVER['HTTP_ACCEPT']
• PHP : $_SERVER['HTTP_ACCEPT_CHARSET']
• PHP : $_SERVER['HTTP_HOST']
• PHP : $_SERVER['REMOTE_PORT']
• PHP : $_SERVER['SCRIPT_FILENAME']
• PHP : $_SERVER['SERVER_ADMIN']
$_REQUEST
• is used to collect data after submitting an HTML
form.

• a super global array just like $_GET, $_POST,


$_COOKIE, $_SESSION etc. That means it can store a
list information numerically or associatively.

You might also like