Hello Readers,
Today we will discuss about "Php server variables".
$_SERVER is one of the tremendous world-wide specifics within PHP. It includes information regarding headers, server, web host in addition to and many others. Its content has enormous directory information along with proper world-wide indices.
There are few type of variable which we listed below :-
- Server information
- Header information
- Details on PHP page request
- File name or path information
- Remote user information
- Server information :-
- GATEWAY_INTERFACE:
Holds the name of common gateway version under which server is running.
<?php $_SERVER['GATEWAY_INTERFACE']; ?>
- SERVER_NAME: Holds the server name.
<?php $_SERVER['SERVER_NAME']; ?>
- SERVER_ADDR: Holds server IP address.
<?php $_SERVER['SERVER_ADDR']; ?>
- SERVER_PORT: Hold the port number of the server.
<?php $_SERVER['SERVER_PORT']; ?>
- SERVER_PROTOCOL: Holds the name of the protocol.
<?php $_SERVER['SERVER_PROTOCOL']; ?>
- Server Header information :-
- HTTP_HOST: IT holds the http host information.
<?php $_SERVER['HTTP_HOST']; ?>
- HTTP_CONNECTION: It holds the http connection information.
<?php $_SERVER['HTTP_CONNECTION']; ?>
- HTTP_ACCEPT_CHARSET: Charaterset information.
<?php $_SERVER['HTTP_ACCEPT_CHARSET']; ?>
- HTTP_ACCEPT_ENCODING: Encoding nformation.
<?php $_SERVER['HTTP_ACCEPT_ENCODING']; ?>
- HTTP_ACCEPT_LANGUAGE: Language information.
<?php $_SERVER['HTTP_ACCEPT_LANGUAGE']; ?>
- Details on PHP page request :-
$_SERVER['REQUEST_METHOD'];
$_SERVER['REQUEST_TIME'];
- 4. File name or path information
- PHP_SELF: Hold the current url of the page.
<?php $_SERVER['PHP_SELF']; ?>
- DOCUMENT_HOLD: Hold name of the root directory as specified in PHP configuration file php.ini.
<?php $_SERVER['DOCUMENT_HOLD']; ?>
- QUERY_STRING: Hold the parameter of the url i.e, localhost/demo/home.php?user_id="1"
<?php $_SERVER['QUERY_STRING']; ?>
- REQUEST_URL: full path of the page running currently.
<?php $_SERVER['QUERY_STRING']; ?>
- SCRIPT_FILENAME: full path of the page running currently.
<?php $_SERVER['SCRIPT_FILENAME'];?>
- PATH_INFO:It consists information if anything given at the client side.
<?php $_SERVER['PATH_INFO']; ?>
- Remote user information
<?php $_SERVER['REMOTE_HOST']; ?>
<?php $_SERVER['REMOTE_ADDR']; ?
<?php $_SERVER['REMOTE_ADDR']; ?>
0 Comment(s)