Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Php server variables

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 6.33k
    Comment on it

    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 :-

    1. Server information
    2. Header information
    3. Details on PHP page request
    4. File name or path information
    5. Remote user information

    1. 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']; ?> 
    



    1. 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']; ?>
    



    1. Details on PHP page request :-


    • REQUEST_METHOD:
    $_SERVER['REQUEST_METHOD'];
    


    • REQUEST_TIME:
    $_SERVER['REQUEST_TIME'];
    



    1. 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']; ?>
    



    1. Remote user information


    • REMOTE_HOST:
    <?php $_SERVER['REMOTE_HOST']; ?>
    


    • REMOTE_ADDR:
    <?php $_SERVER['REMOTE_ADDR']; ?
    


    • REMOTE_PORT:
    <?php $_SERVER['REMOTE_ADDR']; ?>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: